MessageBox.Show 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
메시지 상자를 표시합니다.
오버로드
Show(String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text);
public static System.Windows.Forms.DialogResult Show(string text);
public static System.Windows.Forms.DialogResult Show(string? text);
static member Show : string -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
반품
값 중 DialogResult 하나입니다.
예제
다음 코드 예제에서는 간단한 메시지 상자를 표시 합니다.
private void DisplayMessageBoxText()
{
MessageBox.Show("Hello, world.");
}
Private Sub DisplayMessageBoxText()
MessageBox.Show("Hello, world.")
End Sub
설명
기본적으로 메시지 상자에 는 확인 단추가 표시됩니다. 메시지 상자에 제목에 캡션이 없습니다.
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일 및 도움말 키워드를 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::String ^ keyword);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, string keyword);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, string keyword);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, keyword As String) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- keyword
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 키워드입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 주 창에 부모 메시지 상자를 표시 하는 방법을 보여 줍니다. 메시지 상자에 도움말 단추가 표시됩니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 키워드로 mspaint.chm::/paint_brush.htm 식별된 항목이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file,
// and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
// associated topic.
System::Windows::Forms::DialogResult r8 = MessageBox::Show( this, "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" );
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file,
// and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
// associated topic.
DialogResult r8 = MessageBox.Show (this, "Message with Help file and keyword.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1, 0,
"mspaint.chm",
"mspaint.chm::/paint_brush.htm");
' Display message box parented to the main form.
' The Help button opens the Mspaint.chm Help file,
' and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
' associated topic.
Dim r8 As DialogResult = MessageBox.Show(Me, "Message with Help file and keyword.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, 0, _
"mspaint.chm", _
"mspaint.chm::/paint_brush.htm")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로). 매개 변수를 owner 사용하여 대화 상자의 최상위 소유자 역할을 하는 인터페이스를 IWin32Window 구현하는 특정 개체를 지정할 수 있습니다.
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 keyword 식별된 도움말 키워드 항목이 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일 HelpNavigator및 도움말 항목을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::Windows::Forms::HelpNavigator navigator, System::Object ^ param);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator, object param);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator, object? param);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * System.Windows.Forms.HelpNavigator * obj -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator, param As Object) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- navigator
- HelpNavigator
값 중 HelpNavigator 하나입니다.
- param
- Object
사용자가 도움말 단추를 클릭할 때 표시할 도움말 항목의 숫자 ID입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 도움말 단추가 있는 메시지 상자를 표시하는 방법을 보여 줍니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 도움말 인덱스 탭과 키워드로 ovals 식별된 항목이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box. The Help button opens the Mspaint.chm Help file,
// shows index with the "ovals" keyword selected, and displays the
// associated topic.
System::Windows::Forms::DialogResult r5 = MessageBox::Show( "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" );
// Display a message box. The Help button opens the Mspaint.chm Help file,
// shows index with the "ovals" keyword selected, and displays the
// associated topic.
DialogResult r5 = MessageBox.Show ("Message with Help file and Help navigator with additional parameter.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0, "mspaint.chm",
HelpNavigator.KeywordIndex, "ovals");
' Display a message box. The Help button opens the Mspaint.chm Help file,
' shows index with the "ovals" keyword selected, and displays the
' associated topic.
Dim r5 As DialogResult = MessageBox.Show("Message with Help file and Help navigator with additional parameter.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, "mspaint.chm", _
HelpNavigator.KeywordIndex, "ovals")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 navigator 식별된 도움말 콘텐츠가 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
컴파일된 도움말 파일은 페이지의 목차, 인덱스, 검색 및 키워드 링크를 제공합니다. 에 대해 다음 값을 사용할 수 있습니다.navigatorTableOfContentsFindIndexTopic
명령을 추가로 구체화 param 하는 데 사용할 Topic 수 있습니다. 매개 변수에 navigator 지정된 값이 , TableOfContents또는 Index이 값이어야 Find하는 null경우 . 매개 변수가 navigator 참조 Topic하는 경우 이 값은 표시할 토픽의 숫자 값이 포함된 개체를 참조해야 합니다.
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 기본 폼에 부모 메시지 상자를 표시 하는 방법을 보여 줍니다. 메시지 상자에 도움말 단추가 표시됩니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열립니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box parented to the main form.
// The Help button opens the Mspaint.chm Help file.
System::Windows::Forms::DialogResult r2 = MessageBox::Show( this, "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" );
// Display a message box parented to the main form.
// The Help button opens the Mspaint.chm Help file.
DialogResult r2 = MessageBox.Show (this, "Message with Help file.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0,
"mspaint.chm");
' Display a message box parented to the main form.
' The Help button opens the Mspaint.chm Help file.
Dim r2 As DialogResult = MessageBox.Show(Me, "Message with Help file.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, _
"mspaint.chm")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로). 매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다.
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열립니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다 HelpNavigator.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::Windows::Forms::HelpNavigator navigator);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * System.Windows.Forms.HelpNavigator -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- navigator
- HelpNavigator
값 중 HelpNavigator 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 도움말 단추가 있는 메시지 상자를 표시하는 방법을 보여 줍니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 도움말 인덱스 탭이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box. The Help button opens
// the Mspaint.chm Help file and shows the Help contents
// on the Index tab.
System::Windows::Forms::DialogResult r3 = MessageBox::Show( "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index );
// Display a message box. The Help button opens
// the Mspaint.chm Help file and shows the Help contents
// on the Index tab.
DialogResult r3 = MessageBox.Show ("Message with Help file and Help navigator.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0, "mspaint.chm",
HelpNavigator.Index);
' Display a message box. The Help button opens
' the Mspaint.chm Help file and shows the Help contents
' on the Index tab.
Dim r3 As DialogResult = MessageBox.Show("Message with Help file and Help navigator.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, "mspaint.chm", _
HelpNavigator.Index)
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 navigator 식별된 도움말 콘텐츠가 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
컴파일된 도움말 파일은 페이지의 목차, 인덱스, 검색 및 키워드 링크를 제공합니다. 에 대해 다음 값을 사용할 수 있습니다.navigatorTableOfContentsFindIndexTopic
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일 및 도움말 키워드를 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::String ^ keyword);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, string keyword);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, string keyword);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, keyword As String) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- keyword
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 키워드입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 도움말 단추가 있는 메시지 상자를 표시하는 방법을 보여 줍니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 키워드로 mspaint.chm::/paint_brush.htm 식별된 항목이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box. The Help button opens the Mspaint.chm Help file,
// and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
// associated topic.
System::Windows::Forms::DialogResult r7 = MessageBox::Show( "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" );
// Display a message box. The Help button opens the Mspaint.chm Help file,
// and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
// associated topic.
DialogResult r7 = MessageBox.Show ("Message with Help file and keyword.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1, 0,
"mspaint.chm",
"mspaint.chm::/paint_brush.htm");
' Display a message box. The Help button opens the Mspaint.chm Help file,
' and the "mspaint.chm::/paint_brush.htm" Help keyword shows the
' associated topic.
Dim r7 As DialogResult = MessageBox.Show("Message with Help file and keyword.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, 0, _
"mspaint.chm", _
"mspaint.chm::/paint_brush.htm")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 keyword 식별된 도움말 키워드 항목이 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추 및 옵션이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 가 .의 MessageBoxDefaultButton멤버가 아닌 경우
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
options매개 변수의 DefaultDesktopOnlyServiceNotification 값을 지정하거나 owner 지정했습니다. 이러한 두 옵션은 매개 변수를 사용하지 owner 않는 이 메서드의 버전을 호출하는 경우에만 사용해야 합니다.
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수
private:
void validateUserEntry2()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry2()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry2()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 도움말 단추가 있는 메시지 상자를 표시하는 방법을 보여 줍니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열립니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box with a help button.
// The Help button opens the Mspaint.chm Help file.
System::Windows::Forms::DialogResult r1 = MessageBox::Show( "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" );
// Display a message box with a help button.
// The Help button opens the Mspaint.chm Help file.
DialogResult r1 = MessageBox.Show ("Message with Help file.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0,
"mspaint.chm");
' Display a message box with a help button.
' The Help button opens the Mspaint.chm Help file.
Dim r1 As DialogResult = MessageBox.Show("Message with Help file.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, _
"mspaint.chm")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열립니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, Boolean)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, bool displayHelpButton);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, bool displayHelpButton);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, bool displayHelpButton);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * bool -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, displayHelpButton As Boolean) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- displayHelpButton
- Boolean
true도움말 단추를 표시하려면 다음을 실행합니다. 그렇지 않으면 . false 기본값은 false입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 도움말 단추가 있는 메시지 상자를 표시하고, 이벤트를 처리 Control.HelpRequested 하고, 이벤트에 대한 응답으로 사용자 지정 도움말 창을 표시하는 방법을 보여 줍니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display a message box with a Help button. Show a custom Help window
// by handling the HelpRequested event.
System::Windows::Forms::DialogResult AlertMessageWithCustomHelpWindow()
{
// Handle the HelpRequested event for the following message.
this->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested );
this->Tag = "Message with Help button.";
// Show a message box with OK and Help buttons.
System::Windows::Forms::DialogResult r = MessageBox::Show( "Message with Help button.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, true );
// Remove the HelpRequested event handler to keep the event
// from being handled for other message boxes.
this->HelpRequested -= gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested );
// Return the dialog box result.
return r;
}
void Form1_HelpRequested( System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent )
{
// Create a custom Help window in response to the HelpRequested event.
Form^ helpForm = gcnew Form;
// Set up the form position, size, and title caption.
helpForm->StartPosition = FormStartPosition::Manual;
helpForm->Size = System::Drawing::Size( 200, 400 );
helpForm->DesktopLocation = Point(this->DesktopBounds.X + this->Size.Width,this->DesktopBounds.Top);
helpForm->Text = "Help Form";
// Create a label to contain the Help text.
Label^ helpLabel = gcnew Label;
// Add the label to the form and set its text.
helpForm->Controls->Add( helpLabel );
helpLabel->Dock = DockStyle::Fill;
// Use the sender parameter to identify the context of the Help request.
// The parameter must be cast to the Control type to get the Tag property.
Control^ senderControl = dynamic_cast<Control^>(sender);
helpLabel->Text = String::Format( "Help information shown in response to user action on the '{0}' message.", dynamic_cast<String^>(senderControl->Tag) );
// Set the Help form to be owned by the main form. This helps
// to ensure that the Help form is disposed of.
this->AddOwnedForm( helpForm );
// Show the custom Help window.
helpForm->Show();
// Indicate that the HelpRequested event is handled.
hlpevent->Handled = true;
}
// Display a message box with a Help button. Show a custom Help window
// by handling the HelpRequested event.
private DialogResult AlertMessageWithCustomHelpWindow ()
{
// Handle the HelpRequested event for the following message.
this.HelpRequested += new System.Windows.Forms.HelpEventHandler (this.Form1_HelpRequested);
this.Tag = "Message with Help button.";
// Show a message box with OK and Help buttons.
DialogResult r = MessageBox.Show ("Message with Help button.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0, true);
// Remove the HelpRequested event handler to keep the event
// from being handled for other message boxes.
this.HelpRequested -= new System.Windows.Forms.HelpEventHandler (this.Form1_HelpRequested);
// Return the dialog box result.
return r;
}
private void Form1_HelpRequested (System.Object sender, System.Windows.Forms.HelpEventArgs hlpevent)
{
// Create a custom Help window in response to the HelpRequested event.
Form helpForm = new Form ();
// Set up the form position, size, and title caption.
helpForm.StartPosition = FormStartPosition.Manual;
helpForm.Size = new Size (200, 400);
helpForm.DesktopLocation = new Point (this.DesktopBounds.X +
this.Size.Width,
this.DesktopBounds.Top);
helpForm.Text = "Help Form";
// Create a label to contain the Help text.
Label helpLabel = new Label ();
// Add the label to the form and set its text.
helpForm.Controls.Add (helpLabel);
helpLabel.Dock = DockStyle.Fill;
// Use the sender parameter to identify the context of the Help request.
// The parameter must be cast to the Control type to get the Tag property.
Control senderControl = sender as Control;
helpLabel.Text = "Help information shown in response to user action on the '" +
(string)senderControl.Tag + "' message.";
// Set the Help form to be owned by the main form. This helps
// to ensure that the Help form is disposed of.
this.AddOwnedForm (helpForm);
// Show the custom Help window.
helpForm.Show ();
// Indicate that the HelpRequested event is handled.
hlpevent.Handled = true;
}
' Display a message box with a Help button. Show a custom Help window
' by handling the HelpRequested event.
Private Function AlertMessageWithCustomHelpWindow() As DialogResult
' Handle the HelpRequested event for the following message.
AddHandler Me.HelpRequested, AddressOf Me.Form1_HelpRequested
Me.Tag = "Message with Help button."
' Show a message box with OK and Help buttons.
Dim r As DialogResult = MessageBox.Show("Message with Help button.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, True)
' Remove the HelpRequested event handler to keep the event
' from being handled for other message boxes.
RemoveHandler Me.HelpRequested, AddressOf Me.Form1_HelpRequested
' Return the dialog box result.
Return r
End Function
Private Sub Form1_HelpRequested(ByVal sender As System.Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs)
' Create a custom Help window in response to the HelpRequested event.
Dim helpForm As Form = New Form
' Set up the form position, size, and title caption.
With helpForm
.StartPosition = FormStartPosition.Manual
.Size = New Size(200, 400)
.DesktopLocation = New Point(Me.DesktopBounds.X + _
Me.Size.Width, Me.DesktopBounds.Top)
.Text = "Help Form"
End With
' Create a label to contain the Help text.
Dim helpLabel As Label = New Label
' Add the label to the form and set its text.
helpForm.Controls.Add(helpLabel)
helpLabel.Dock = DockStyle.Fill
' Use the sender parameter to identify the context of the Help request.
' The parameter must be cast to the Control type to get the Tag property.
Dim senderControl As Control = CType(sender, Control)
helpLabel.Text = "Help information shown in response to user action on the '" & _
CStr(senderControl.Tag) & "' message."
' Set the Help form to be owned by the main form. This helps
' to ensure that the Help form is disposed of.
Me.AddOwnedForm(helpForm)
' Show the custom Help window.
helpForm.Show()
' Indicate that the HelpRequested event is handled.
hlpevent.Handled = True
End Sub
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
사용자가 도움말 단추를 클릭하면 메시지 상자(또는 활성 폼)를 소유하는 양식이 HelpRequested 이벤트를 받습니다. HelpRequested 사용자 지정 도움말 작업을 수행하기 위해 이벤트를 처리합니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다 HelpNavigator.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::Windows::Forms::HelpNavigator navigator);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * System.Windows.Forms.HelpNavigator -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- navigator
- HelpNavigator
값 중 HelpNavigator 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 주 창에 부모 메시지 상자를 표시 하는 방법을 보여 줍니다. 메시지 상자에 도움말 단추가 표시됩니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 도움말 인덱스 탭이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file
// and shows the Help contents on the Index tab.
System::Windows::Forms::DialogResult r4 = MessageBox::Show( this, "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index );
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file
// and shows the Help contents on the Index tab.
DialogResult r4 = MessageBox.Show (this,
"Message with Help file and Help navigator.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0, "mspaint.chm",
HelpNavigator.Index);
' Display message box parented to the main form.
' The Help button opens the Mspaint.chm Help file
' and shows the Help contents on the Index tab.
Dim r4 As DialogResult = MessageBox.Show(Me, _
"Message with Help file and Help navigator.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, "mspaint.chm", _
HelpNavigator.Index)
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로). 매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다.
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 navigator 식별된 도움말 콘텐츠가 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
컴파일된 도움말 파일은 페이지의 목차, 인덱스, 검색 및 키워드 링크를 제공합니다. 에 대해 다음 값을 사용할 수 있습니다.navigatorTableOfContentsFindIndexTopic
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트, 캡션, 단추, 아이콘 및 기본 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 가 .의 MessageBoxDefaultButton멤버가 아닌 경우
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수
private:
void validateUserEntry2()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry2()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry2()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트, 캡션, 단추 및 아이콘이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수
private:
void validateUserEntry4()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry4()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry4()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트, 캡션, 단추, 아이콘 및 기본 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 가 .의 MessageBoxDefaultButton멤버가 아닌 경우
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수 ServerName가 비어 있는지 확인한 후 이 예제에서는 사용자에게 작업을 취소할 수 있는 옵션을 제공하는 질문 상자 아이콘을 표시 MessageBox 합니다.
Show 메서드의 반환 값이 계산Yes되면 표시된 MessageBox 폼이 닫힙니다.
private:
void validateUserEntry3()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1 );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry3()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry3()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트, 캡션 및 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수
private:
void validateUserEntry5()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry5()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry5()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트, 캡션, 단추 및 아이콘이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이벤트를 처리할 Show 때 메서드 중 하나를 보여 줍니다 ComboBox.DropDown . 예제를 실행하려면 폼에 다음 코드를 붙여넣고 폼의 생성자 또는 InitializeComboBox 메서드에서 메서드를 호출 Load 합니다.
internal:
// Declare ComboBox1
System::Windows::Forms::ComboBox^ ComboBox1;
private:
// Initialize ComboBox1.
void InitializeComboBox()
{
this->ComboBox1 = gcnew ComboBox;
this->ComboBox1->Location = System::Drawing::Point( 128, 48 );
this->ComboBox1->Name = "ComboBox1";
this->ComboBox1->Size = System::Drawing::Size( 100, 21 );
this->ComboBox1->TabIndex = 0;
this->ComboBox1->Text = "Typical";
array<String^>^ installs = {"Typical","Compact","Custom"};
ComboBox1->Items->AddRange( installs );
this->Controls->Add( this->ComboBox1 );
// Hook up the event handler.
this->ComboBox1->DropDown += gcnew System::EventHandler(
this, &Form1::ComboBox1_DropDown );
}
// Handles the ComboBox1 DropDown event. If the user expands the
// drop-down box, a message box will appear, recommending the
// typical installation.
void ComboBox1_DropDown( Object^ sender, System::EventArgs^ e )
{
MessageBox::Show( "Typical installation is strongly recommended.",
"Install information", MessageBoxButtons::OK,
MessageBoxIcon::Information );
}
// Declare ComboBox1.
internal System.Windows.Forms.ComboBox ComboBox1;
// Initialize ComboBox1.
private void InitializeComboBox()
{
this.ComboBox1 = new ComboBox();
this.ComboBox1.Location = new System.Drawing.Point(128, 48);
this.ComboBox1.Name = "ComboBox1";
this.ComboBox1.Size = new System.Drawing.Size(100, 21);
this.ComboBox1.TabIndex = 0;
this.ComboBox1.Text = "Typical";
string[] installs = new string[]{"Typical", "Compact", "Custom"};
ComboBox1.Items.AddRange(installs);
this.Controls.Add(this.ComboBox1);
// Hook up the event handler.
this.ComboBox1.DropDown +=
new System.EventHandler(ComboBox1_DropDown);
}
// Handles the ComboBox1 DropDown event. If the user expands the
// drop-down box, a message box will appear, recommending the
// typical installation.
private void ComboBox1_DropDown(object sender, System.EventArgs e)
{
MessageBox.Show("Typical installation is strongly recommended.",
"Install information", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
' Declare ComboBox1.
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
' Initialize ComboBox1.
Private Sub InitializeComboBox()
Me.ComboBox1 = New ComboBox
Me.ComboBox1.Location = New System.Drawing.Point(128, 48)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(100, 21)
Me.ComboBox1.TabIndex = 0
Me.ComboBox1.Text = "Typical"
Dim installs() As String = New String() _
{"Typical", "Compact", "Custom"}
ComboBox1.Items.AddRange(installs)
Me.Controls.Add(Me.ComboBox1)
End Sub
' Handles the ComboBox1 DropDown event. If the user expands the
' drop-down box, a message box will appear, recommending the
' typical installation.
Private Sub ComboBox1_DropDown _
(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles ComboBox1.DropDown
MessageBox.Show("Typical installation is strongly recommended.", _
"Install information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
설명
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트와 캡션이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption);
static member Show : System.Windows.Forms.IWin32Window * string * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
반품
값 중 DialogResult 하나입니다.
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
기본적으로 메시지 상자에 는 확인 단추가 표시됩니다.
적용 대상
Show(String, String, MessageBoxButtons)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트, 캡션 및 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 지정된 매개 변수가 .의 MessageBoxButtons멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수
private:
void validateUserEntry()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "Error Detected in Input";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(message, caption, buttons);
if (result == System.Windows.Forms.DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "Error Detected in Input"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays the MessageBox
Result = MessageBox.Show(Message, Caption, Buttons)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 개체 앞에 지정된 텍스트가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text);
static member Show : System.Windows.Forms.IWin32Window * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
반품
값 중 DialogResult 하나입니다.
설명
매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다. 메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로).
기본적으로 메시지 상자에 는 확인 단추가 표시됩니다. 메시지 상자에 제목에 캡션이 없습니다.
적용 대상
Show(String, String)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트와 캡션이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption);
public static System.Windows.Forms.DialogResult Show(string text, string caption);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption);
static member Show : string * string -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
반품
값 중 DialogResult 하나입니다.
설명
기본적으로 메시지 상자에 는 확인 단추가 표시됩니다.
적용 대상
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추 및 옵션이 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options);
public static System.Windows.Forms.DialogResult Show(string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options);
public static System.Windows.Forms.DialogResult Show(string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options);
static member Show : string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions -> System.Windows.Forms.DialogResult
Public Shared Function Show (text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions) As DialogResult
매개 변수
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 이 오버로드MessageBox에서 Show 지원하는 옵션을 사용하여 표시하는 방법을 보여 줍니다. 문자열 변수 ServerName가 비어 있는지 확인한 후 이 예제에서는 사용자에게 작업을 취소할 수 있는 옵션을 제공하는 질문 상자 아이콘을 표시 MessageBox 합니다. 이 예제에서는 열거형의 RightAlign 멤버를 사용하여 MessageBoxOptions 텍스트가 대화 상자의 오른쪽 가장자리에 맞춰지도록 합니다.
Show 메서드의 반환 값이 계산Yes되면 표시된 MessageBox 폼이 닫힙니다.
private:
void validateUserEntry2()
{
// Checks the value of the text.
if ( serverName->Text->Length == 0 )
{
// Initializes the variables to pass to the MessageBox::Show method.
String^ message = "You did not enter a server name. Cancel this operation?";
String^ caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons::YesNo;
System::Windows::Forms::DialogResult result;
// Displays the MessageBox.
result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign );
if ( result == ::DialogResult::Yes )
{
// Closes the parent form.
this->Close();
}
}
}
private void validateUserEntry2()
{
// Checks the value of the text.
if(serverName.Text.Length == 0)
{
// Initializes the variables to pass to the MessageBox.Show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign);
if(result == DialogResult.Yes)
{
// Closes the parent form.
this.Close();
}
}
}
Private Sub ValidateUserEntry2()
' Checks the value of the text.
If ServerName.Text.Length = 0 Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "You did not enter a server name. Cancel this operation?"
Dim Caption As String = "No Server Name Specified"
Dim Buttons As Integer = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays a MessageBox using the Question icon and specifying the No button as the default.
Result = MessageBox.Show(Me, Message, Caption, MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Closes the parent form.
Me.Close()
End If
End If
End Sub
설명
메시지 상자에는 최대 3개의 단추가 있을 수 있습니다.
추가 정보
적용 대상
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
- Source:
- MessageBox.cs
지정된 도움말 파일 HelpNavigator및 도움말 항목을 사용하여 지정된 텍스트, 캡션, 단추, 아이콘, 기본 단추, 옵션 및 도움말 단추가 있는 메시지 상자를 표시합니다.
public:
static System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner, System::String ^ text, System::String ^ caption, System::Windows::Forms::MessageBoxButtons buttons, System::Windows::Forms::MessageBoxIcon icon, System::Windows::Forms::MessageBoxDefaultButton defaultButton, System::Windows::Forms::MessageBoxOptions options, System::String ^ helpFilePath, System::Windows::Forms::HelpNavigator navigator, System::Object ^ param);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window owner, string text, string caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator, object param);
public static System.Windows.Forms.DialogResult Show(System.Windows.Forms.IWin32Window? owner, string? text, string? caption, System.Windows.Forms.MessageBoxButtons buttons, System.Windows.Forms.MessageBoxIcon icon, System.Windows.Forms.MessageBoxDefaultButton defaultButton, System.Windows.Forms.MessageBoxOptions options, string helpFilePath, System.Windows.Forms.HelpNavigator navigator, object? param);
static member Show : System.Windows.Forms.IWin32Window * string * string * System.Windows.Forms.MessageBoxButtons * System.Windows.Forms.MessageBoxIcon * System.Windows.Forms.MessageBoxDefaultButton * System.Windows.Forms.MessageBoxOptions * string * System.Windows.Forms.HelpNavigator * obj -> System.Windows.Forms.DialogResult
Public Shared Function Show (owner As IWin32Window, text As String, caption As String, buttons As MessageBoxButtons, icon As MessageBoxIcon, defaultButton As MessageBoxDefaultButton, options As MessageBoxOptions, helpFilePath As String, navigator As HelpNavigator, param As Object) As DialogResult
매개 변수
- owner
- IWin32Window
이 구현은 IWin32Window 모달 대화 상자를 소유합니다.
- text
- String
메시지 상자에 표시할 텍스트입니다.
- caption
- String
메시지 상자의 제목 표시줄에 표시할 텍스트입니다.
- buttons
- MessageBoxButtons
MessageBoxButtons 메시지 상자에 표시할 단추를 지정하는 값 중 하나입니다.
- icon
- MessageBoxIcon
MessageBoxIcon 메시지 상자에 표시할 아이콘을 지정하는 값 중 하나입니다.
- defaultButton
- MessageBoxDefaultButton
메시지 상자의 MessageBoxDefaultButton 기본 단추를 지정하는 값 중 하나입니다.
- options
- MessageBoxOptions
MessageBoxOptions 메시지 상자에 사용할 표시 및 연결 옵션을 지정하는 값 중 하나입니다. 기본값을 사용하려는 경우 0을 전달할 수 있습니다.
- helpFilePath
- String
사용자가 도움말 단추를 클릭할 때 표시할 도움말 파일의 경로와 이름입니다.
- navigator
- HelpNavigator
값 중 HelpNavigator 하나입니다.
- param
- Object
사용자가 도움말 단추를 클릭할 때 표시할 도움말 항목의 숫자 ID입니다.
반품
값 중 DialogResult 하나입니다.
예외
buttons 가 .의 MessageBoxButtons멤버가 아닌 경우
-또는-
icon 가 .의 MessageBoxIcon멤버가 아닌 경우
-또는-
defaultButton 지정한 값이 .의 MessageBoxDefaultButton멤버가 아닙니다.
사용자 대화형 모드에서 실행되지 않는 프로세스를 표시 MessageBox 하려고 했습니다. 속성에 의해 UserInteractive 지정됩니다.
options을 지정했습니다DefaultDesktopOnly.ServiceNotification
-또는-
buttons 의 잘못된 조합을 지정했습니다 MessageBoxButtons.
예제
다음 코드 예제에서는 주 창에 부모 메시지 상자를 표시 하는 방법을 보여 줍니다. 메시지 상자에 도움말 단추가 표시됩니다. 사용자가 도움말 단추를 Mspaint.chm 클릭하면 도움말 파일이 열리고 도움말 인덱스 탭과 키워드로 ovals 식별된 항목이 표시됩니다. 이 예제에서는 Mspaint.chm 도움말 파일을 설치해야 합니다.
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file,
// shows index with the "ovals" keyword selected, and displays the
// associated topic.
System::Windows::Forms::DialogResult r6 = MessageBox::Show( this, "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" );
// Display message box parented to the main form.
// The Help button opens the Mspaint.chm Help file,
// shows index with the "ovals" keyword selected, and displays the
// associated topic.
DialogResult r6 = MessageBox.Show (this,
"Message with Help file and Help navigator with additional parameter.",
"Help Caption", MessageBoxButtons.OK,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1,
0, "mspaint.chm",
HelpNavigator.KeywordIndex, "ovals");
' Display message box parented to the main form.
' The Help button opens the Mspaint.chm Help file,
' shows index with the "ovals" keyword selected, and displays the
' associated topic.
Dim r6 As DialogResult = MessageBox.Show(Me, _
"Message with Help file and Help navigator with additional parameter.", _
"Help Caption", MessageBoxButtons.OK, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button1, _
0, "mspaint.chm", _
HelpNavigator.KeywordIndex, "ovals")
설명
메시지 상자는 모달 대화 상자입니다. 즉, 모달 폼의 개체를 제외하고 입력(키보드 또는 마우스 클릭)이 발생할 수 없습니다. 프로그램은 다른 양식에 대한 입력이 발생하기 전에 모달 폼을 숨기거나 닫아야 합니다(일반적으로 일부 사용자 작업에 대한 응답으로). 매개 변수를 owner 사용하여 대화 상자의 최상위 창 및 소유자 역할을 하는 인터페이스를 구현 IWin32Window 하는 특정 개체를 지정할 수 있습니다.
사용자가 도움말 단추를 클릭하면 매개 변수에 helpFilePath 지정된 도움말 파일이 열리고 매개 변수로 navigator 식별된 도움말 콘텐츠가 표시됩니다. 메시지 상자(또는 활성 폼)를 소유하는 양식도 이벤트를 받습니다 HelpRequested .
컴파일된 도움말 파일은 페이지의 목차, 인덱스, 검색 및 키워드 링크를 제공합니다. 에 대해 다음 값을 사용할 수 있습니다.navigatorTableOfContentsFindIndexTopic
명령을 추가로 구체화 param 하는 데 사용할 Topic 수 있습니다. 매개 변수에 navigator 지정된 값이 , TableOfContents또는 Index이 값이어야 Find하는 null경우 . 매개 변수가 navigator 참조 Topic하는 경우 이 값은 표시할 토픽의 숫자 값이 포함된 개체를 참조해야 합니다.
매개 변수는 helpFilePath C:\path\sample.chm 또는 /folder/file.htm형식일 수 있습니다.