ExceptionMessageBox クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Microsoft Windows .NET Framework ベースのアプリケーションでカスタマー エクスペリエンスを向上させるために、テキスト、ボタン、シンボルを使用してカスタマイズできるメッセージ ボックスを表示します。
public ref class ExceptionMessageBox
[System.Runtime.InteropServices.ComVisible(false)]
public class ExceptionMessageBox
[<System.Runtime.InteropServices.ComVisible(false)>]
type ExceptionMessageBox = class
Public Class ExceptionMessageBox
- 継承
-
ExceptionMessageBox
- 属性
例
次の使用例は、[ OK] ボタンを含むメッセージ ボックスを表示します。
try
{
// Do something that may generate an exception.
throw new ApplicationException("An error has occured");
}
catch (ApplicationException ex)
{
// Define a new top-level error message.
string str = "The action failed.";
// Add the new top-level message to the handled exception.
ApplicationException exTop = new ApplicationException(str, ex);
exTop.Source = this.Text;
// Show an exception message box with an OK button (the default).
ExceptionMessageBox box = new ExceptionMessageBox(exTop);
box.Show(this);
}
Try
' Do something that may generate an exception.
Throw New ApplicationException("An error has occured")
Catch ex As ApplicationException
' Define a new top-level error message.
Dim str As String = "The action failed."
' Add the new top-level message to the handled exception.
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Show an exception message box with an OK button (the default).
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
box.Show(Me)
End Try
この例では、例外メッセージ ボックスを使用して、トラブルシューティングやデバッグに役立つ追加情報を表示します。
try
{
// Do something that you don't expect to generate an exception.
throw new ApplicationException("Failed to connect to the server.");
}
catch (ApplicationException ex)
{
string str = "An unexpected error occurred. Please call Helpdesk.";
ApplicationException exTop = new ApplicationException(str, ex);
exTop.Source = this.Text;
// Information in the Data property of an exception that has a name
// beginning with "HelpLink.Advanced" is shown when the user
// clicks the Advanced Information button of the exception message
// box dialog box.
exTop.Data.Add("AdvancedInformation.FileName", "application.dll");
exTop.Data.Add("AdvancedInformation.FilePosition", "line 355");
exTop.Data.Add("AdvancedInformation.UserContext", "single user mode");
// Show the exception message box with additional information that
// is helpful when a user calls technical support.
ExceptionMessageBox box = new ExceptionMessageBox(exTop);
box.Show(this);
}
Try
' Do something that you don't expect to generate an exception.
Throw New ApplicationException("Failed to connect to the server.")
Catch ex As ApplicationException
Dim str As String = "An unexpected error occurred. Please call Helpdesk."
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Information in the Data property of an exception that has a name
' beginning with "HelpLink.Advanced" is shown when the user
' clicks the Advanced Information button of the exception message
' box dialog box.
exTop.Data.Add("AdvancedInformation.FileName", "application.dll")
exTop.Data.Add("AdvancedInformation.FilePosition", "line 355")
exTop.Data.Add("AdvancedInformation.UserContext", "single user mode")
' Show the exception message box with additional information that
' is helpful when a user calls technical support.
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
box.Show(Me)
End Try
コンストラクター
プロパティ
AbortButtonText |
[中止] ボタンの既定のテキストを取得します。 |
Beep |
メッセージが表示されるときに、サウンドを再生するかどうかを指定します。 |
Buttons |
メッセージ ボックスに表示するボタンを取得します。値の設定も可能です。 |
CancelButtonText |
[キャンセル] ボタンの既定のテキストを取得します。 |
Caption |
例外メッセージ ボックスのダイアログ ボックス キャプションを取得します。値の設定も可能です。 |
CheckBoxRegistryKey |
開いている RegistryKey を設定して、ShowCheckBox が |
CheckBoxRegistryMeansDoNotShowDialog |
CheckBoxRegistryKey および CheckBoxRegistryValue により指定されたレジストリ値の内容が、このメッセージを表示しないというユーザーの以前の決定を示しているかどうかを判別します。 |
CheckBoxRegistryValue |
ShowCheckBox が |
CheckBoxText |
ShowCheckBox が |
CustomDialogResult |
クリックしたカスタム テキスト ダイアログ ボタンを取得します。 |
CustomSymbol |
例外メッセージ ボックスで記号として使用するカスタム ビットマップを取得します。値の設定も可能です。 |
Data |
最上位レベル メッセージに関連付けられたヘルプ リンクおよび詳細情報を格納する IDictionary インターフェイスを取得します。 |
DefaultButton |
メッセージ ボックスの既定のボタンを取得します。値の設定も可能です。 |
DefaultDialogResult |
特定のメッセージを再度表示しないようにユーザーに前回指示が行われた際に、Show(IWin32Window) メソッドによって返された値を取得します。値の設定も可能です。 |
FailButtonText |
[失敗] ボタンの既定のテキストを取得します。 |
Font |
メッセージ ボックスで使用するフォントを取得します。値の設定も可能です。 |
HelpLink |
最上位レベル メッセージに関連付けられるヘルプ ファイルまたはヘルプ Web ページへのリンクを取得します。値の設定も可能です。 |
IgnoreButtonText |
[無視] ボタンの既定のテキストを取得します。 |
InnerException |
下位レベル メッセージに関連付けられた Exception インスタンスを取得します。値の設定も可能です。 |
IsCheckBoxChecked |
ShowCheckBox が |
Message |
表示するメッセージが含まれる Exception を取得します。値の設定も可能です。 |
MessageLevelDefault |
メッセージ ボックスに表示するメッセージ レベルの数を取得します。値の設定も可能です。 |
NoButtonText |
[いいえ] ボタンの既定のテキストを取得します。 |
OKButtonText |
[OK] ボタンの既定のテキストを取得します。 |
Options |
メッセージ ボックスのその他の表示オプションを取得します。値の設定も可能です。 |
RetryButtonText |
[再試行] ボタンの既定のテキストを取得します。 |
ShowCheckBox |
例外メッセージ ボックスにチェック ボックスを表示するかどうかを指定します。 |
ShowToolBar |
例外メッセージ ボックスにコマンド ボタン ツール バーを表示するかどうかを指定します。 |
Symbol |
例外メッセージ ボックスに表示される記号を取得します。値の設定も可能です。 |
Text |
例外メッセージ ボックスに表示される最上位レベル メッセージのテキストを取得します。値の設定も可能です。 |
UseOwnerFont |
オーナー ウィンドウのフォントを取得して、それを例外メッセージ ボックスのフォントとして使用するかどうかを指定します。 |
YesButtonText |
[はい] ボタンの既定のテキストを取得します。 |
メソッド
GetMessageText(Exception) |
例外メッセージ ボックスに例外が表示されたときにユーザーがクリップボードにコピー可能な文字列を返します。 |
SetButtonText(String) |
例外メッセージ ボックスにボタンが 1 つだけ表示される場合の、カスタム テキスト ボタンのテキストを設定します。 |
SetButtonText(String, String) |
例外メッセージ ボックスにボタンが 2 つだけ表示される場合の、カスタム テキスト ボタンのテキストを設定します。 |
SetButtonText(String, String, String) |
例外メッセージ ボックスにボタンが 3 つだけ表示される場合の、カスタム テキスト ボタンのテキストを設定します。 |
SetButtonText(String, String, String, String) |
例外メッセージ ボックスにボタンが 4 つだけ表示される場合の、カスタム テキスト ボタンのテキストを設定します。 |
SetButtonText(String, String, String, String, String) |
例外メッセージ ボックスにボタンが 5 つだけ表示される場合の、カスタム テキスト ボタンのテキストを設定します。 |
Show(IntPtr, String, String, String, String, String, String, String) |
例外メッセージ ボックスを表示します。 単に情報を示すためだけに特定されます。 サポートされていません。 将来の互換性は保証されません。 |
Show(IWin32Window) |
例外メッセージ ボックスを、親ウィンドウの中央にモーダル ダイアログ ボックスとして表示します。 |
イベント
OnCopyToClipboard |
例外メッセージ テキストがメッセージ ボックスからクリップボードにコピーされた場合に発生します。 |