文章出處

1.

// 摘要:

// 顯示具有指定文本的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

public static DialogResult Show(string text);

 

        例子:MessageBox.Show("內容");

2.

// 摘要:

// 顯示具有指定文本和標題的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

public static DialogResult Show(string text, string caption);

 

    例子:MessageBox.Show("內容","標題");

3.

// 摘要:

// 顯示具有指定文本、標題和按鈕的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// buttons:

// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中顯示哪些按鈕。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

//

// 異常:

// System.ComponentModel.InvalidEnumArgumentException:

// 指定的 buttons 參數不是 System.Windows.Forms.MessageBoxButtons 的成員。

//

// System.InvalidOperationException:

// 試圖在運行模式不是用戶交互模式的進程中顯示 System.Windows.Forms.MessageBox。這是由 System.Windows.Forms.SystemInformation.UserInteractive

// 屬性指定的。

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons);

例子:MessageBox.Show("內容","標題",要在消息框中顯示的按鈕);

   MessageBox.Show("內容", "標題", MessageBoxButtons.OK);

4.

//

// 摘要:

// 顯示具有指定文本、標題、按鈕和圖標的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// buttons:

// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中顯示哪些按鈕。

//

// icon:

// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中顯示哪個圖標。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

//

// 異常:

// System.ComponentModel.InvalidEnumArgumentException:

// 指定的 buttons 參數不是 System.Windows.Forms.MessageBoxButtons 的成員。- 或 - 指定的 icon

// 參數不是 System.Windows.Forms.MessageBoxIcon 的成員。

//

// System.InvalidOperationException:

// 試圖在運行模式不是用戶交互模式的進程中顯示 System.Windows.Forms.MessageBox。這是由 System.Windows.Forms.SystemInformation.UserInteractive

// 屬性指定的。

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);

 

例子:MessageBox.Show("內容","標題",MessageBox.Button,按鈕,MessageBox.Icon.圖標);

       MessageBox.Show("內容", "標題", MessageBoxButtons.OK,MessageBoxIcon.Warning);  

 

5.

// 摘要:

// 顯示具有指定文本、標題、按鈕、圖標和默認按鈕的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// buttons:

// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中顯示哪些按鈕。

//

// icon:

// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中顯示哪個圖標。

//

// defaultButton:

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

//

// 異常:

// System.ComponentModel.InvalidEnumArgumentException:

// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成員。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon

// 的成員。- 或 - defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton 的成員。

//

// System.InvalidOperationException:

// 試圖在運行模式不是用戶交互模式的進程中顯示 System.Windows.Forms.MessageBox。這是由 System.Windows.Forms.SystemInformation.UserInteractive

// 屬性指定的。

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton);

//MessageBox.Show("內容", "標題", 要顯示的按鈕,要顯示的圖標,設置默認按鈕);

//設置第一個按鈕為默認按鈕,代碼如下:

 

 MessageBox.Show("內容", "標題", MessageBoxButtons.OK,MessageBoxIcon.Warning,MessageBoxDefaultButton.Button1);

6.

//

// 摘要:

// 顯示具有指定文本、標題、按鈕、圖標、默認按鈕和選項的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// buttons:

// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中顯示哪些按鈕。

//

// icon:

// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中顯示哪個圖標。

//

// defaultButton:

// System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默認按鈕。

//

// options:

// System.Windows.Forms.MessageBoxOptions 值之一,可指定將對消息框使用哪些顯示和關聯選項。若要使用默認值,請傳入

// 0。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

//

// 異常:

// System.ComponentModel.InvalidEnumArgumentException:

// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成員。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon

// 的成員。- 或 - 指定的 defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton

// 的成員。

//

// System.InvalidOperationException:

// 試圖在運行模式不是用戶交互模式的進程中顯示 System.Windows.Forms.MessageBox。這是由 System.Windows.Forms.SystemInformation.UserInteractive

// 屬性指定的。

//

// System.ArgumentException:

// options 同時指定了 System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly 和

// System.Windows.Forms.MessageBoxOptions.ServiceNotification。- 或 - buttons

// 指定了無效的 System.Windows.Forms.MessageBoxButtons 組合。

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options);

 

7.

//

// 摘要:

// 使用指定的幫助文件、HelpNavigator 和幫助主題顯示一個具有指定文本、標題、按鈕、圖標、默認按鈕、選項和"幫助"按鈕的消息框。

//

// 參數:

// text:

// 要在消息框中顯示的文本。

//

// caption:

// 要在消息框的標題欄中顯示的文本。

//

// buttons:

// System.Windows.Forms.MessageBoxButtons 值之一,可指定在消息框中顯示哪些按鈕。

//

// icon:

// System.Windows.Forms.MessageBoxIcon 值之一,它指定在消息框中顯示哪個圖標。

//

// defaultButton:

// System.Windows.Forms.MessageBoxDefaultButton 值之一,可指定消息框中的默認按鈕。

//

// options:

// System.Windows.Forms.MessageBoxOptions 值之一,可指定將對消息框使用哪些顯示和關聯選項。若要使用默認值,請傳入

// 0。

//

// helpFilePath:

// 用戶單擊"幫助"按鈕時顯示的"幫助"文件的路徑和名稱。

//

// navigator:

// System.Windows.Forms.HelpNavigator 值之一。

//

// param:

// 用戶單擊"幫助"按鈕時顯示的幫助主題的數值 ID。

//

// 返回結果:

// System.Windows.Forms.DialogResult 值之一。

//

// 異常:

// System.ComponentModel.InvalidEnumArgumentException:

// buttons 不是 System.Windows.Forms.MessageBoxButtons 的成員。- 或 - icon 不是 System.Windows.Forms.MessageBoxIcon

// 的成員。- 或 - 指定的 defaultButton 不是 System.Windows.Forms.MessageBoxDefaultButton

// 的成員。

//

// System.InvalidOperationException:

// 試圖在運行模式不是用戶交互模式的進程中顯示 System.Windows.Forms.MessageBox。這是由 System.Windows.Forms.SystemInformation.UserInteractive

// 屬性指定的。

//

// System.ArgumentException:

// options 同時指定了 System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly 和

// System.Windows.Forms.MessageBoxOptions.ServiceNotification。- 或 - buttons

// 指定了無效的 System.Windows.Forms.MessageBoxButtons 組合。

public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, HelpNavigator navigator, object param);

 


文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()