×

VB.Net基本教程

VB.Net 环境设置VB.Net 程序结构VB.Net 基本语法VB.Net 数据类型VB.Net 变量VB.Net 常数和枚举VB.Net 修饰符VB.Net 声明VB.Net 指令VB.Net 运算符VB.Net 决策VB.Net 循环VB.Net 字符串VB.Net 日期和时间VB.Net 数组VB.Net 集合VB.Net 函数VB.Net Sub过程(子程序)VB.Net 类与对象VB.Net 异常处理VB.Net 文件处理VB.Net 基本控制VB.Net 对话框VB.Net 高级表单VB.Net 事件处理

VB.Net 高级教程

VB.Net 正则表达式VB.Net 数据库访问VB.Net Excel工作表VB.Net 发送邮件VB.Net XML处理VB.Net Web编程

VB.Net 有用的资源

VB.Net 有用资源

VB.Net 对话框


有许多内置的对话框,用于Windows窗体中的各种任务,例如打开和保存文件,打印页面,向应用程序的用户提供颜色,字体,页面设置等选择。 这些内置的对话框减少了开发人员的时间和工作量。

所有这些对话框控件类继承自CommonDialog类,并覆盖基类的RunDialog()函数以创建特定对话框。

当对话框的用户调用其ShowDialog()函数时,将自动调用RunDialog()函数。

ShowDialog方法用于在运行时显示所有对话框控件。 它返回一个DialogResult枚举类型的值。 DialogResult枚举的值为:

  • Abort 中止 - returns DialogResult.Abort value, when user clicks an Abort button.  当用户单击“中止”按钮时,返回DialogResult.Abort值。

  • Cancel 取消 -returns DialogResult.Cancel, when user clicks a Cancel button.  当用户单击Ignore按钮时,返回DialogResult.Ignore。

  • Ignore 忽略 -returns DialogResult.Ignore, when user clicks an Ignore button.  返回DialogResult.No,当用户单击否按钮。

  • No  -returns DialogResult.No, when user clicks a No button.  不返回任何内容,对话框继续运行。

  • None  -returns nothing and the dialog box continues running.  返回DialogResult.OK,当用户单击确定按钮

  • OK -returns DialogResult.OK, when user clicks an OK button.  返回DialogResult.  OK,当用户点击OK键

  • Retry 重试 -returns DialogResult.Retry , when user clicks an Retry button.  当用户单击重试按钮时,返回DialogResult.Retry

  • Yes  -returns DialogResult.Yes, when user clicks an Yes button.  返回DialogResult.Yes,当用户单击是按钮


下图显示了通用对话框类继承:


VB.Net对话框

上述所有相应控件,可以在设计期间从工具箱中添加。 您可以通过以编程方式实例化类或通过使用相关控件,将这些类的相关功能包括到应用程序中。

当双击工具箱中的任何对话框控件或将控件拖动到窗体上时,它将显示在Windows窗体设计器底部的组件托盘中,但不会直接显示在窗体上。

下表列出了常用的对话框控件。 点击以下链接查看其详细信息:

 
S.N. 控制& 说明
1

ColorDialog

It represents a common dialog box that displays available colors along with controls that enable the user to define custom colors.

它表示一个公共对话框,显示可用颜色以及允许用户定义自定义颜色的控件。

2

FontDialog

It prompts the user to choose a font from among those installed on the local computer and lets the user select the font, font size, and color.

它提示用户从安装在本地计算机上的字体中选择字体,并让用户选择字体,字体大小和颜色。

3

OpenFileDialog

It prompts the user to open a file and allows the user to select a file to open.

它提示用户打开文件,并允许用户选择要打开的文件。

4

SaveFileDialog

It prompts the user to select a location for saving a file and allows the user to specify the name of the file to save data.

它提示用户选择保存文件的位置,并允许用户指定保存数据的文件的名称。

5

PrintDialog

It lets the user to print documents by selecting a printer and choosing which sections of the document to print from a Windows Forms application.

它允许用户通过选择打印机并从Windows窗体应用程序中选择要打印的文档的哪些部分来打印文档。


分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)