ExceptionMessageBox.CheckBoxRegistryKey 속성

정의

가 가 있을 trueShowCheckBox 예외 메시지 상자에 표시되는 체크박스를 제어하는 opened RegistryKey 를 설정합니다.

public:
 property Microsoft::Win32::RegistryKey ^ CheckBoxRegistryKey { Microsoft::Win32::RegistryKey ^ get(); void set(Microsoft::Win32::RegistryKey ^ value); };
public Microsoft.Win32.RegistryKey CheckBoxRegistryKey { get; set; }
member this.CheckBoxRegistryKey : Microsoft.Win32.RegistryKey with get, set
Public Property CheckBoxRegistryKey As RegistryKey

속성 값

RegistryKey A 는 예외 메시지 상자 ShowCheckBoxtrue에 표시되는 체크박스를 제어하는 데 있습니다.

예제

try
{
    // Do something that could generate an exception.
    throw new ApplicationException("An error has occured.");
}
catch (ApplicationException ex)
{
    string str = "The action failed. Do you want to continue?";
    ApplicationException exTop = new ApplicationException(str, ex);
    exTop.Source = this.Text;

    // Show a message box with Yes and No buttons
    ExceptionMessageBox box = new ExceptionMessageBox(exTop,
        ExceptionMessageBoxButtons.YesNo,
        ExceptionMessageBoxSymbol.Question,
        ExceptionMessageBoxDefaultButton.Button2);

    // Enable the check box.
    box.ShowCheckBox = true;

    // Define the registry key to use.
    box.CheckBoxRegistryKey =
        Microsoft.Win32.Registry.CurrentUser.CreateSubKey(
        @"Software\TestApp");
    box.CheckBoxRegistryValue = "DontShowActionFailedMessage";
    box.CheckBoxRegistryMeansDoNotShowDialog = true;
    box.DefaultDialogResult = DialogResult.Yes;

    // The message box won't be displayed if the
    // "DontShowActionFailedMessage" value of the registry key 
    // contains a non-zero value.
    if (box.Show(this) == DialogResult.No)
    {
        // Do something if the user clicks the No button.
        this.Close();
    }
}
Try
    ' Do something that could generate an exception.
    Throw New ApplicationException("An error has occured.")
Catch ex As ApplicationException
    Dim str As String = "The action failed. Do you want to continue?"
    Dim exTop As ApplicationException = New ApplicationException(str, ex)
    exTop.Source = Me.Text

    ' Show a message box with Yes and No buttons
    Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop, _
     ExceptionMessageBoxButtons.YesNo, _
     ExceptionMessageBoxSymbol.Question, _
     ExceptionMessageBoxDefaultButton.Button2)

    ' Enable the check box.
    box.ShowCheckBox = True

    ' Define the registry key to use.
    box.CheckBoxRegistryKey = _
    Microsoft.Win32.Registry.CurrentUser.CreateSubKey( _
     "Software\TestApp")
    box.CheckBoxRegistryValue = "DontShowActionFailedMessage"
    box.CheckBoxRegistryMeansDoNotShowDialog = True
    box.DefaultDialogResult = Windows.Forms.DialogResult.Yes

    ' The message box won't be displayed if the
    ' "DontShowActionFailedMessage" value of the registry key 
    ' contains a non-zero value.
    If box.Show(Me) = Windows.Forms.DialogResult.No Then
        ' Do something if the user clicks the No button.
        Me.Close()
    End If
End Try

설명

이 속성은 체크 CheckBoxRegistryValue 박스의 선택된 상태를 초기화하는 데 사용됩니다. 지정된 레지스트리 값이 존재하며 0이 아닌 값을 포함하면, 체크박스가 선택된 것으로 표시됩니다; 그렇지 않으면 체크박스가 '없음'으로 표시됩니다. CheckBoxRegistryMeansDoNotShowDialog 만약 가 이고 true 레지스트리 값이 존재하며 0이 아닌 값을 포함한다면, 메시지 상자는 표시되지 않고 ExceptionMessageBox 호출 시 Show 반환 DefaultDialogResult 됩니다.

RegistryKey 신청서가 호출Show하기 전에 반드시 열어야 합니다.

적용 대상