没有合适的资源?快使用搜索试试~ 我知道了~
.net学习笔记.txt
资源推荐
资源详情
资源评论
.net学习笔记
http://dev.21tx.com 2006年05月16日
每日文章精萃
.Net:Visual C#编程入门之C#的程序结构 Java:jdbc应用--数据库连接全集
ASP:ASP 中 DateDiff 函数详解 PHP:PHP实现自动刷数和“灌水”机
JSP:在JSP开发中模拟.NET WebForm(一) CGI:用Perl语言进行Socket编程之四
VB:一个实现程序启动窗口界面特效的程序 VC:OICQ登录号码清除器实现原理
Form.DialogResult属性 (表示当窗体用作对话框时该窗体的结果。)
窗体的对话框结果是当窗体显示为模式对话框时,从该窗体返回的值。如果该窗体显示为对话框,用来自 DialogResult 枚举的值设置此属性可以为该窗体设置对话框结果的值、隐藏该模式对话框并将控件返回到调用窗体。此属性通常由窗体上 Button 控件的 DialogResult 属性设置。当用户单击 Button 控件时,分配给 Button 的 DialogResult 属性的值将分配给该窗体的 DialogResult 属性。
当窗体显示为模式对话框时,单击“关闭”按钮(窗体右上角带 X 的按钮)将使窗体隐藏,并使 DialogResult 属性设置为 DialogResult.Cancel。当用户单击对话框的“关闭”按钮或设置 DialogResult 属性的该值时,不自动调用 Close 方法。而是隐藏该窗体并可重新显示该窗体,而不用创建该对话框的新实例。因为此行为,所以当应用程序不再需要该窗体时,必须调用该窗体的 Dispose 方法。
可以使用此属性确定对话框是如何关闭的,以便正确处理在该对话框中执行的操作。
注意 通过在窗体的 Closing 事件的事件处理程序中设置 DialogResult 属性,可以重写用户单击“关闭”按钮时分配给 DialogResult 属性的值。
注意 如果 Form 显示为无模式窗口,则 DialogResult 属性返回的值可能不返回分配给该窗体的值,因为关闭该窗体时将自动释放该窗体的资源。
[C#]
1public void CreateMyForm()
http://dev.21tx.com 2006年05月16日
每日文章精萃
.Net:Visual C#编程入门之C#的程序结构 Java:jdbc应用--数据库连接全集
ASP:ASP 中 DateDiff 函数详解 PHP:PHP实现自动刷数和“灌水”机
JSP:在JSP开发中模拟.NET WebForm(一) CGI:用Perl语言进行Socket编程之四
VB:一个实现程序启动窗口界面特效的程序 VC:OICQ登录号码清除器实现原理
Form.DialogResult属性 (表示当窗体用作对话框时该窗体的结果。)
窗体的对话框结果是当窗体显示为模式对话框时,从该窗体返回的值。如果该窗体显示为对话框,用来自 DialogResult 枚举的值设置此属性可以为该窗体设置对话框结果的值、隐藏该模式对话框并将控件返回到调用窗体。此属性通常由窗体上 Button 控件的 DialogResult 属性设置。当用户单击 Button 控件时,分配给 Button 的 DialogResult 属性的值将分配给该窗体的 DialogResult 属性。
当窗体显示为模式对话框时,单击“关闭”按钮(窗体右上角带 X 的按钮)将使窗体隐藏,并使 DialogResult 属性设置为 DialogResult.Cancel。当用户单击对话框的“关闭”按钮或设置 DialogResult 属性的该值时,不自动调用 Close 方法。而是隐藏该窗体并可重新显示该窗体,而不用创建该对话框的新实例。因为此行为,所以当应用程序不再需要该窗体时,必须调用该窗体的 Dispose 方法。
可以使用此属性确定对话框是如何关闭的,以便正确处理在该对话框中执行的操作。
注意 通过在窗体的 Closing 事件的事件处理程序中设置 DialogResult 属性,可以重写用户单击“关闭”按钮时分配给 DialogResult 属性的值。
注意 如果 Form 显示为无模式窗口,则 DialogResult 属性返回的值可能不返回分配给该窗体的值,因为关闭该窗体时将自动释放该窗体的资源。
[C#]
1public void CreateMyForm()
2 ...{
3 // Create a new instance of the form.
4 Form form1 = new Form();
5 // Create two buttons to use as the accept and cancel buttons.
6 Button button1 = new Button ();
7 Button button2 = new Button ();
8
9 // Set the text of button1 to "OK".
10 button1.Text = "OK";
11 // Set the position of the button on the form.
12 button1.Location = new Point (10, 10);
13 // Set the text of button2 to "Cancel".
14 button2.Text = "Cancel";
15 // Set the position of the button based on the location of button1.
16 button2.Location
17 = new Point (button1.Left, button1.Height + button1.Top + 10);
18 // Make button1's dialog result OK.
19 button1.DialogResult = DialogResult.OK;
20 // Make button2's dialog result Cancel.
21 button2.DialogResult = DialogResult.Cancel;
22 // Set the caption bar text of the form.
23 form1.Text = "My Dialog Box";
24
25 // Define the border style of the form to a dialog box.
26 form1.FormBorderStyle = FormBorderStyle.FixedDialog;
27 // Set the accept button of the form to button1.
28 form1.AcceptButton = button1;
29 // Set the cancel button of the form to button2.
30 form1.CancelButton = button2;
31 // Set the start position of the form to the center of the screen.
3 // Create a new instance of the form.
4 Form form1 = new Form();
5 // Create two buttons to use as the accept and cancel buttons.
6 Button button1 = new Button ();
7 Button button2 = new Button ();
8
9 // Set the text of button1 to "OK".
10 button1.Text = "OK";
11 // Set the position of the button on the form.
12 button1.Location = new Point (10, 10);
13 // Set the text of button2 to "Cancel".
14 button2.Text = "Cancel";
15 // Set the position of the button based on the location of button1.
16 button2.Location
17 = new Point (button1.Left, button1.Height + button1.Top + 10);
18 // Make button1's dialog result OK.
19 button1.DialogResult = DialogResult.OK;
20 // Make button2's dialog result Cancel.
21 button2.DialogResult = DialogResult.Cancel;
22 // Set the caption bar text of the form.
23 form1.Text = "My Dialog Box";
24
25 // Define the border style of the form to a dialog box.
26 form1.FormBorderStyle = FormBorderStyle.FixedDialog;
27 // Set the accept button of the form to button1.
28 form1.AcceptButton = button1;
29 // Set the cancel button of the form to button2.
30 form1.CancelButton = button2;
31 // Set the start position of the form to the center of the screen.
剩余5页未读,继续阅读
资源评论
lhjnnn
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功