天天看點

C# 擷取messagebox按鈕的值

DialogResult dr = MessageBox(

"消息内容"

,

"傳回值 是6 否7"

,MessageBoxButtons.YesNo, MessageBoxIcon.Hand);

if

(dr == DialogResult.YES)

{

MessageBox(

"點選了按鈕”是“"

);

}

else

{

MessageBox(

"點選了按鈕”否“"

);

}

【函數】 <整型> MessageBox(<字元串 Text, <字元串> Title, <整型> nType,MessageBoxIcon);

【函數說明】 彈出一個消息框。

【文法】 參數:Text <字元串>,消息框的正文;Title <字元串>,消息框的标題;nType <整型>,消息框的類型。 傳回值:<整型>,使用者在消息框上點選關閉時的選擇的按鈕。MessageBoxIcon:對話框上顯示的圖示樣式。

繼續閱讀