VB用户界面设计实验报告
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一、
Public Class _7_1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ColorDialog1.ShowDialog()
Label1.ForeColor = ColorDialog1.Color
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Shell("C:\WINDOWS\system32\notepad.exe", 1)
End Sub
End Class
二、
Public Class _7_2
Private Sub清除ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles清除ToolStripMenuItem.Click
TextBox1.Text = ""
End Sub
Private Sub结束ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles结束ToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub号ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles号ToolStripMenuItem.Click
TextBox1.Font = New Font(, 8)
End Sub
Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ToolStripMenuItem2.Click
TextBox1.Font = New Font(, 12)
End Sub
Private Sub粗体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles粗体ToolStripMenuItem.Click
TextBox1.Font = New Font(TextBox1.Font, FontStyle.Bold)
End Sub
Private Sub斜体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles斜体ToolStripMenuItem.Click
TextBox1.Font = New Font(TextBox1.Font, FontStyle.Italic)
End Sub
End Class
三、
在实验2中继续添加下列代码
Private Sub号字体ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles号字体ToolStripMenuItem1.Click
TextBox1.Font = New Font(, 8)
End Sub
Private Sub斜体ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles斜体ToolStripMenuItem2.Click
TextBox1.Font = New Font(TextBox1.Font, FontStyle.Italic)
End Sub
Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
TextBox1.Font = New Font(, 12)
End Sub
Private Sub粗体ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles粗体ToolStripMenuItem2.Click
TextBox1.Font = New Font(TextBox1.Font, FontStyle.Bold)
End Sub
Private Sub打开文件ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles打开文件ToolStripMenuItem.Click
Dim inputdata As String
OpenFileDialog1.FileName = "*.txt"
OpenFileDialog1.InitialDirectory = "d:\"
OpenFileDialog1.Filter = "text files(*.txt)|*.txt|all files(*.*)|*.*"
OpenFileDialog1.FilterIndex = 2
OpenFileDialog1.ShowDialog()
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
TextBox1.Text = ""
Do While Not EOF(1)
inputdata = LineInput(1)
TextBox1.Text = TextBox1.Text + inputdata + vbCrLf
Loop
FileClose(1)
End Sub
End Class
四、
Public Class Sy7_6
Private Sub实验11ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles实验11ToolStripMenuItem.Click
Sy1_1.Show()
End Sub
Private Sub实验12ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles实验12ToolStripMenuItem.Click
Sy1_2.ShowDialog()