b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

listbox删除选中项_panel有什么作用_dialogresult.ok

电脑杂谈  发布时间:2017-02-01 14:29:24  来源:网络整理

点击某个按钮后,使得取值为OK,或才Yes,哪么,就要给该按钮行为中的DialogResult赋值。[喝小酒的网摘]

button1.DialogResult = DialogResult.OK;

当然也可以在设计模式时指定。具体的取值如下所示:

None Nothing is returned from the dialog box. This means that the modal dialog continues running.

OK The dialog box return value is OK (usually sent from a button labeled OK).

Cancel The dialog box return value is Cancel (usually sent from a button labeled Cancel).

Abort The dialog box return value is Abort (usually sent from a button labeled Abort).

Retry The dialog box return value is Retry (usually sent from a button labeled Retry).

Ignore The dialog box return value is Ignore (usually sent from a button labeled Ignore).

Yes The dialog box return value is Yes (usually sent from a button labeled Yes).

No The dialog box return value is No (usually sent from a button labeled No).

示例:

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();

}

}

}

Winform里不专门区别对话框和窗口。

调用窗口的ShowDialog()方法就是以模态方式显示;调用Show()显示就是非模态的。

大概调用模式是这样:

Form1 frm = new Form1();

if (frm.ShowDialog(this)

== System.Windows.Forms.DialogResult.OK) // 如果选择了"确定"


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-29924-1.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 李宁
      李宁

      美国害的伊拉克还不够惨吗

    热点图片
    拼命载入中...