1 / 12

实训十三 菜单栏、对话框、工具栏和状态栏

实训十三 菜单栏、对话框、工具栏和状态栏. 一、实训目的 1 、掌握各种菜单、对话框、工具栏和状态栏的设计方法; 2 、掌握各种菜单、对话框、工具栏和状态栏事件过程的编写方法。 二、实训内容 1 、菜单栏. 【 实训要求 】. 利用菜单栏中的命令显示“三十六计”中的前四计的内容。 【 实训步骤 】 第 1 步: 启动 VB ,打开一个新的标准工程。 第 2 步: 在窗体上添加一个标签和一个文本框。 第 3 步: 设置属性: ( 1 )设置对象属性:. ( 2 )设置菜单项的属性:. 打开菜单编辑器,按上面的属性设置建立菜单如左图:.

amanda
Download Presentation

实训十三 菜单栏、对话框、工具栏和状态栏

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 实训十三 菜单栏、对话框、工具栏和状态栏 一、实训目的 1、掌握各种菜单、对话框、工具栏和状态栏的设计方法; 2、掌握各种菜单、对话框、工具栏和状态栏事件过程的编写方法。 二、实训内容 1、菜单栏

  2. 【实训要求】 利用菜单栏中的命令显示“三十六计”中的前四计的内容。 【实训步骤】 • 第1步:启动VB,打开一个新的标准工程。 • 第2步:在窗体上添加一个标签和一个文本框。 • 第3步:设置属性: (1)设置对象属性:

  3. (2)设置菜单项的属性:

  4. 打开菜单编辑器,按上面的属性设置建立菜单如左图:打开菜单编辑器,按上面的属性设置建立菜单如左图: 设置完所有属性后的界面如右图:

  5. 第4步:编写各自菜单项的代码: sx13_1.VBP Option Explicit Private Sub exit_Click(Index As Integer) End End Sub Private Sub jdsr_Click(Index As Integer) Label1.Caption = "借刀杀人" Label1.FontSize = 24 Label1.FontName = "隶书" Text1.FontSize = 16 Text1.FontBold = True Text1.FontName = "黑体" Text1.Text = "共敌不如分敌,敌阳不如敌阴。" End Sub

  6. 各自菜单项的代码: Private Sub mtgh_Click(Index As Integer) Label1.Caption = "瞒天过海" Label1.FontSize = 24 Label1.FontName = "隶书" Text1.FontSize = 16 Text1.FontBold = True Text1.FontName = "黑体" Text1.Text = "敌已明,友未定,引友杀敌,不自出力,以损推演。" End Sub

  7. 各自菜单项的代码: Private Sub wwjz_Click(Index As Integer) Label1.Caption = "围魏救赵" Label1.FontSize = 24 Label1.FontName = "隶书" Text1.FontSize = 16 Text1.FontBold = True Text1.FontName = "黑体" Text1.Text = "备击则意怠,常见则不疑。阴在阳之内,不在阳之外。" End Sub

  8. 各自菜单项的代码: Private Sub yydl_Click(Index As Integer) Label1.Caption = "以逸待劳" Label1.FontSize = 24 Label1.FontName = "隶书" Text1.FontSize = 16 Text1.FontBold = True Text1.FontName = "黑体" Text1.Text = "困敌之势,不以战,损则益柔。" End Sub

  9. 第5步:运行程序后,界面如图所示: • 做一做: 在该实验中加上弹出式菜单,实现同样功能。

  10. 2、对话框 【实训要求】 • 设计一个工程,利用通用对话框选择文件以实现文件的复制。 • 界面设计参见左图。 sx13_2.VBP • 运行程序时的界面参见右图。

  11. 3、工具栏 【实训要求】 • 设计一个工程,利用工具栏按钮以实现相应功能。 • 界面设计参见下图。 sx13_3.VBP

  12. 4、做一做 【实训要求】参见例题“综合应用”利用工具栏、状态栏和RichTextBox控件设计一个工程,以实现写字板的功能。

More Related