ExceptionMessageBoxSymbol Enumeração
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Especifica o símbolo que será exibido na caixa de mensagem de exceção.
public enum class ExceptionMessageBoxSymbol
public enum ExceptionMessageBoxSymbol
type ExceptionMessageBoxSymbol =
Public Enum ExceptionMessageBoxSymbol
- Herança
-
ExceptionMessageBoxSymbol
Campos
Asterisk | 5 | O símbolo de asterisco do sistema. |
Error | 3 | O símbolo de erro do sistema. |
Exclamation | 4 | O símbolo de ponto de exclamação do sistema. |
Hand | 7 | O símbolo de mão do sistema. |
Information | 2 | O símbolo de informação do sistema. |
None | 0 | Nenhum símbolo. |
Question | 6 | O símbolo de ponto de interrogação do sistema. |
Stop | 3 | O símbolo de sinal de parada do sistema. |
Warning | 1 | O símbolo de aviso do sistema. |
Exemplos
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
Comentários
Os membros são ExceptionMessageBoxSymbol ícones gráficos mantidos pelo sistema.