MessageBox.Show Metodo
Definizione
Visualizza una finestra di messaggio.Displays a message box.
Overload
Show(String) |
Visualizza una finestra di messaggio contenente un messaggio e che restituisce un risultato.Displays a message box that has a message and that returns a result. |
Show(String, String) |
Visualizza una finestra di messaggio contenente un messaggio e una didascalia per la barra del titolo e che restituisce un risultato.Displays a message box that has a message and title bar caption; and that returns a result. |
Show(Window, String) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio visualizza un messaggio e restituisce un risultato.The message box displays a message and returns a result. |
Show(String, String, MessageBoxButton) |
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo e un pulsante e che restituisce un risultato.Displays a message box that has a message, title bar caption, and button; and that returns a result. |
Show(Window, String, String) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio e una didascalia per la barra del titolo e restituisce un risultato.The message box displays a message and title bar caption; and it returns a result. |
Show(String, String, MessageBoxButton, MessageBoxImage) |
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that returns a result. |
Show(Window, String, String, MessageBoxButton) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo e un pulsante e restituisce un risultato.The message box displays a message, title bar caption, and button; and it also returns a result. |
Show(String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult) |
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che accetta un risultato predefinito e restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that accepts a default message box result and returns a result. |
Show(Window, String, String, MessageBoxButton, MessageBoxImage) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and it also returns a result. |
Show(String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult, MessageBoxOptions) |
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che accetta un risultato predefinito, è conforme alle opzioni specificate e restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that accepts a default message box result, complies with the specified options, and returns a result. |
Show(Window, String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e accetta un risultato predefinito e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and accepts a default message box result and returns a result. |
Show(Window, String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult, MessageBoxOptions) |
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e accetta un risultato predefinito, è conforme alle opzioni specificate e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and accepts a default message box result, complies with the specified options, and returns a result. |
Commenti
Usare un overload del Show metodo, che consente di specificare una finestra proprietaria.Use an overload of the Show method, which enables you to specify an owner window. In caso contrario, la finestra di messaggio è di proprietà della finestra attualmente attiva.Otherwise, the message box is owned by the window that is currently active.
Show(String)
Visualizza una finestra di messaggio contenente un messaggio e che restituisce un risultato.Displays a message box that has a message and that returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText);
public static System.Windows.MessageBoxResult Show (string messageBoxText);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText);
static member Show : string -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Hello, MessageBox!";
// Show message box
MessageBoxResult result = MessageBox.Show(message);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Hello, MessageBox!"
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message)
End Sub
Si applica a
Show(String, String)
Visualizza una finestra di messaggio contenente un messaggio e una didascalia per la barra del titolo e che restituisce un risultato.Displays a message box that has a message and title bar caption; and that returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText, System::String ^ caption);
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption);
static member Show : string * string -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string * string -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String, caption As String) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Message text";
string caption = "Caption text";
// Show message box
MessageBoxResult result = MessageBox.Show(message, caption);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Message text"
Dim caption As String = "Caption text"
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message, caption)
End Sub
Si applica a
Show(Window, String)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio visualizza un messaggio e restituisce un risultato.The message box displays a message and returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText);
static member Show : System.Windows.Window * string -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
Si applica a
Show(String, String, MessageBoxButton)
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo e un pulsante e che restituisce un risultato.Displays a message box that has a message, title bar caption, and button; and that returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button);
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button);
static member Show : string * string * System.Windows.MessageBoxButton -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string * string * System.Windows.MessageBoxButton -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String, caption As String, button As MessageBoxButton) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Hello, MessageBox!";
string caption = "Caption text";
MessageBoxButton buttons = MessageBoxButton.OKCancel;
// Show message box
MessageBoxResult result = MessageBox.Show(message, caption, buttons);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Hello, MessageBox!"
Dim caption As String = "Caption text"
Dim buttons As MessageBoxButton = MessageBoxButton.OKCancel
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message, caption, buttons)
End Sub
Si applica a
Show(Window, String, String)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio e una didascalia per la barra del titolo e restituisce un risultato.The message box displays a message and title bar caption; and it returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText, System::String ^ caption);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption);
static member Show : System.Windows.Window * string * string -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string * string -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String, caption As String) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
Si applica a
Show(String, String, MessageBoxButton, MessageBoxImage)
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon);
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon);
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Hello, MessageBox!";
string caption = "Caption text";
MessageBoxButton buttons = MessageBoxButton.OKCancel;
MessageBoxImage icon = MessageBoxImage.Information;
// Show message box
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Hello, MessageBox!"
Dim caption As String = "Caption text"
Dim buttons As MessageBoxButton = MessageBoxButton.OKCancel
Dim icon As MessageBoxImage = MessageBoxImage.Information
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message, caption, buttons, icon)
End Sub
Si applica a
Show(Window, String, String, MessageBoxButton)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo e un pulsante e restituisce un risultato.The message box displays a message, title bar caption, and button; and it also returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button);
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String, caption As String, button As MessageBoxButton) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
Si applica a
Show(String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult)
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che accetta un risultato predefinito e restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that accepts a default message box result and returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon, System::Windows::MessageBoxResult defaultResult);
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult);
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage, defaultResult As MessageBoxResult) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
- defaultResult
- MessageBoxResult
Valore MessageBoxResult che specifica il risultato predefinito della finestra di messaggio.A MessageBoxResult value that specifies the default result of the message box.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Hello, MessageBox!";
string caption = "Caption text";
MessageBoxButton buttons = MessageBoxButton.OKCancel;
MessageBoxImage icon = MessageBoxImage.Information;
MessageBoxResult defaultResult = MessageBoxResult.OK;
// Show message box
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon, defaultResult);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Hello, MessageBox!"
Dim caption As String = "Caption text"
Dim buttons As MessageBoxButton = MessageBoxButton.OKCancel
Dim icon As MessageBoxImage = MessageBoxImage.Information
Dim defaultResult As MessageBoxResult = MessageBoxResult.OK
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message, caption, buttons, icon, defaultResult)
End Sub
Si applica a
Show(Window, String, String, MessageBoxButton, MessageBoxImage)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and it also returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon);
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
Si applica a
Show(String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult, MessageBoxOptions)
Visualizza una finestra di messaggio contenente un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e che accetta un risultato predefinito, è conforme alle opzioni specificate e restituisce un risultato.Displays a message box that has a message, title bar caption, button, and icon; and that accepts a default message box result, complies with the specified options, and returns a result.
public:
static System::Windows::MessageBoxResult Show(System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon, System::Windows::MessageBoxResult defaultResult, System::Windows::MessageBoxOptions options);
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult, System.Windows.MessageBoxOptions options);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult, System.Windows.MessageBoxOptions options);
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult * System.Windows.MessageBoxOptions -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult * System.Windows.MessageBoxOptions -> System.Windows.MessageBoxResult
Public Shared Function Show (messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage, defaultResult As MessageBoxResult, options As MessageBoxOptions) As MessageBoxResult
Parametri
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
- defaultResult
- MessageBoxResult
Valore MessageBoxResult che specifica il risultato predefinito della finestra di messaggio.A MessageBoxResult value that specifies the default result of the message box.
- options
- MessageBoxOptions
Oggetto valore MessageBoxOptions che specifica le opzioni.A MessageBoxOptions value object that specifies the options.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Esempio
Nell'esempio seguente viene illustrato come utilizzare questo overload del Show metodo.The following example shows how to use this overload of the Show method.
private void ShowMessageBoxButton_Click(object sender, RoutedEventArgs e)
{
// Configure message box
string message = "Hello, MessageBox!";
string caption = "Caption text";
MessageBoxButton buttons = MessageBoxButton.OKCancel;
MessageBoxImage icon = MessageBoxImage.Information;
MessageBoxResult defaultResult = MessageBoxResult.OK;
MessageBoxOptions options = MessageBoxOptions.RtlReading;
// Show message box
MessageBoxResult result = MessageBox.Show(message, caption, buttons, icon, defaultResult, options);
}
Private Sub showMessageBoxButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
' Configure message box
Dim message As String = "Hello, MessageBox!"
Dim caption As String = "Caption text"
Dim buttons As MessageBoxButton = MessageBoxButton.OKCancel
Dim icon As MessageBoxImage = MessageBoxImage.Information
Dim defaultResult As MessageBoxResult = MessageBoxResult.OK
Dim options As MessageBoxOptions = MessageBoxOptions.RtlReading
' Show message box
Dim result As MessageBoxResult = MessageBox.Show(message, caption, buttons, icon, defaultResult, options)
End Sub
Si applica a
Show(Window, String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e accetta un risultato predefinito e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and accepts a default message box result and returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon, System::Windows::MessageBoxResult defaultResult);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult);
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage, defaultResult As MessageBoxResult) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
- defaultResult
- MessageBoxResult
Valore MessageBoxResult che specifica il risultato predefinito della finestra di messaggio.A MessageBoxResult value that specifies the default result of the message box.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
Si applica a
Show(Window, String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult, MessageBoxOptions)
Visualizza una finestra di messaggio davanti alla finestra specificata.Displays a message box in front of the specified window. La finestra di messaggio contiene un messaggio, una didascalia per la barra del titolo, un pulsante e un'icona e accetta un risultato predefinito, è conforme alle opzioni specificate e restituisce un risultato.The message box displays a message, title bar caption, button, and icon; and accepts a default message box result, complies with the specified options, and returns a result.
public:
static System::Windows::MessageBoxResult Show(System::Windows::Window ^ owner, System::String ^ messageBoxText, System::String ^ caption, System::Windows::MessageBoxButton button, System::Windows::MessageBoxImage icon, System::Windows::MessageBoxResult defaultResult, System::Windows::MessageBoxOptions options);
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult, System.Windows.MessageBoxOptions options);
[System.Security.SecurityCritical]
public static System.Windows.MessageBoxResult Show (System.Windows.Window owner, string messageBoxText, string caption, System.Windows.MessageBoxButton button, System.Windows.MessageBoxImage icon, System.Windows.MessageBoxResult defaultResult, System.Windows.MessageBoxOptions options);
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult * System.Windows.MessageBoxOptions -> System.Windows.MessageBoxResult
[<System.Security.SecurityCritical>]
static member Show : System.Windows.Window * string * string * System.Windows.MessageBoxButton * System.Windows.MessageBoxImage * System.Windows.MessageBoxResult * System.Windows.MessageBoxOptions -> System.Windows.MessageBoxResult
Public Shared Function Show (owner As Window, messageBoxText As String, caption As String, button As MessageBoxButton, icon As MessageBoxImage, defaultResult As MessageBoxResult, options As MessageBoxOptions) As MessageBoxResult
Parametri
- owner
- Window
Oggetto Window che rappresenta la finestra proprietaria della finestra di messaggio.A Window that represents the owner window of the message box.
- messageBoxText
- String
Oggetto String che specifica il testo da visualizzare.A String that specifies the text to display.
- caption
- String
Oggetto String che specifica la didascalia della barra del titolo da visualizzare.A String that specifies the title bar caption to display.
- button
- MessageBoxButton
Valore MessageBoxButton che specifica il pulsante o i pulsanti da visualizzare.A MessageBoxButton value that specifies which button or buttons to display.
- icon
- MessageBoxImage
Valore MessageBoxImage che specifica l'icona da visualizzare.A MessageBoxImage value that specifies the icon to display.
- defaultResult
- MessageBoxResult
Valore MessageBoxResult che specifica il risultato predefinito della finestra di messaggio.A MessageBoxResult value that specifies the default result of the message box.
- options
- MessageBoxOptions
Oggetto valore MessageBoxOptions che specifica le opzioni.A MessageBoxOptions value object that specifies the options.
Restituisce
Valore MessageBoxResult che specifica il pulsante della finestra di messaggio scelto dall'utente.A MessageBoxResult value that specifies which message box button is clicked by the user.
- Attributi
Commenti
Per impostazione predefinita, la finestra di messaggio viene visualizzata davanti alla finestra attualmente attiva.By default, the message box appears in front of the window that is currently active.
Vedi anche
- Activated
- Show(String, String, MessageBoxButton, MessageBoxImage, MessageBoxResult, MessageBoxOptions)