vb.用户界面设

上传人:xins****2008 文档编号:105018783 上传时间:2019-10-11 格式:DOC 页数:8 大小:32KB
返回 下载 相关 举报
vb.用户界面设_第1页
第1页 / 共8页
vb.用户界面设_第2页
第2页 / 共8页
vb.用户界面设_第3页
第3页 / 共8页
vb.用户界面设_第4页
第4页 / 共8页
vb.用户界面设_第5页
第5页 / 共8页
点击查看更多>>
资源描述

《vb.用户界面设》由会员分享,可在线阅读,更多相关《vb.用户界面设(8页珍藏版)》请在金锄头文库上搜索。

1、14实验七 用户界面设计2012年 5 月 24 日姓名: 学号:班级:成绩:一、实验目的:1 学会使用通用对话框控件进行编程。2 掌握下拉式菜单和弹出式菜单的设计方法。3 综合应用所学的知识,编制具有可视化界面的应用程序。二、实验内容:1 理论教材p308第1-4题,操作可参照实验教材中P108页。 第1题的书上提示: Shell(notepad.exe + + OpenFileDialog1.FileName, 1)2 理论教材p308第2-4题(请用一个项目程序完成),操作可参照实验教材中P108-109页。“打开文件”代码:OpenFileDialog1.FileName = *.tx

2、t OpenFileDialog1.Filter = 文本文件|*.txt|所有文件|*.* OpenFileDialog1.ShowDialog() FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do While Not EOF(1) TextBox1.Text &= LineInput(1) & vbCrLf Loop FileClose(1) 3 附加题:理论教材p305第4题。将此实验报告和代码文件一起打包压缩交上来。三、实验步骤及结果:Public Class Form1 Private Sub Button1_Click

3、(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If ColorDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then Label1.ForeColor = ColorDialog1.Color End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Butt

4、on2.Click If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then Shell(notepad.exe + + OpenFileDialog1.FileName, AppWinStyle.NormalFocus) End If End SubEnd ClassPublic Class Form1 Private Sub 清除ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles

5、清除ToolStripMenuItem.Click TextBox1.Text = End Sub Private Sub 结束ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 结束ToolStripMenuItem.Click End End Sub Private Sub 号ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 号

6、ToolStripMenuItem.Click, c8.Click, H8.Click TextBox1.Font = New Font(TextBox1.Font.Name, 8) End Sub Private Sub 号ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 号ToolStripMenuItem1.Click, c12.Click, H12.Click TextBox1.Font = New Font(TextBox1.Font.Name, 1

7、2) End Sub Private Sub 粗体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 粗体ToolStripMenuItem.Click, ct.Click, CT2.Click TextBox1.Font = New Font(TextBox1.Font.Name, TextBox1.Font.Size, TextBox1.Font.Style Or FontStyle.Bold) End Sub Private Sub 斜体ToolStripM

8、enuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 斜体ToolStripMenuItem.Click, xt.Click, XT2.Click TextBox1.Font = New Font(TextBox1.Font.Name, TextBox1.Font.Size, TextBox1.Font.Style Or FontStyle.Italic) End Sub Private Sub 打开文件ToolStripMenuItem_Click(ByVal sender As S

9、ystem.Object, ByVal e As System.EventArgs) Handles 打开文件ToolStripMenuItem.Click OpenFileDialog1.FileName = *.txt OpenFileDialog1.Filter = 文本文件|*.txt|所有文件|*.* OpenFileDialog1.ShowDialog() FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do While Not EOF(1) TextBox1.Text &= LineInput(1) & vbCrLf L

10、oop FileClose(1) End SubEnd ClassPublic Class Form1 Function fw(ByVal n%) As Double Dim i% fw = 1 For i = 1 To n fw = fw * i Next End Function Sub mysin(ByVal x%, ByRef ms As Double) Dim i, s As Integer s = 1 i = 1 Do ms = ms + s * x (2 * i - 1) / fw(2 * i - 1) i = i + 1 s = -s Loop Until x (2 * i -

11、 1) / fw(2 * i - 1) 10 -5 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim m As Double Dim x% x = Val(TextBox1.Text) mysin(x, m) TextBox2.Text = m End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim x% x = Val(TextBox1.Text) TextBox3.Text = Math.Sin(x) End SubEnd Class四、实验心得:教师评语:

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号