《实验四用户界面设计.docx》由会员分享,可在线阅读,更多相关《实验四用户界面设计.docx(4页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、实验四用户界面设计 “编辑文本文”效果图 菜单1选项菜单2选项“8号”字体效果“12号”字体效果“粗体”效果“斜体”效果 弹窗效果图“8号”效果图 “粗体”效果图 “斜体”效果图打开“file.txt”内容 打开一个txt文件夹 源代码在实验7-2的基础上添加并发事件: Public Class 7_2 Private Sub清除ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles清除ToolStripMenuItem.Click TextBox1.Text = End Sub Private Sub结束ToolSt
2、ripMenuItem_Click(sender As Object, e As EventArgs) Handles结束ToolStripMenuItem.Click Me.Close() End Sub Private Sub号ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles号ToolStripMenuItem.Click,号字体ToolStripMenuItem1.Click TextBox1.Font = New Font( , 8) End Sub Private Sub号ToolStripMenuIt
3、em1_Click(sender As Object, e As EventArgs) Handles号ToolStripMenuItem1.Click,号字体ToolStripMenuItem2.Click TextBox1.Font = New Font( , 12) End Sub Private Sub粗体ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles粗体ToolStripMenuItem.Click,粗体ToolStripMenuItem1.Click TextBox1.Font = New Font
4、(TextBox1.Font, FontStyle.Bold) End Sub Private Sub斜体ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles斜体ToolStripMenuItem.Click,斜体ToolStripMenuItem1.Click TextBox1.Font = New Font( , TextBox1.Font.Size, TextBox1.Font.Style Or FontStyle.Italic) End Sub Private Sub打开文件夹ToolStripMenuIte
5、m_Click(sender As Object, e As EventArgs) Handles打开文件夹ToolStripMenuItem.Click Dim InputData As String OpenFileDialog1.Filter = Text Files(*.TxT)|*.TxT|All File(*.*)|*.* OpenFileDialog1.FilterIndex = 1 If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) TextBox1.Text = Do While Not EOF(1) InputData = LineInput(1) TextBox1.Text = TextBox1.Text + InputData + vbCrLf Loop End If End Sub End Class 6、选择若干个做过的实验,将他们整合成一个如图所示的项目。当选择某个菜单项时,就去弹出相应程序的窗体。 选取5-3的效果图
限制150内