nbsp; '''' Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.closepanel, Me.Label1, Me.mpreplace, Me.findnext, Me.find, Me.rpbox, Me.txtbox}) Me.Panel1.Location = New System.Drawing.Point(192, 160) Me.Panel1.Name = "Panel1" Me.Panel1.Size = New System.Drawing.Size(272, 96) Me.Panel1.TabIndex = 9 Me.Panel1.Visible = False '''' ''''PictureBox1 '''' Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap) Me.PictureBox1.Location = New System.Drawing.Point(8, 8) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New System.Drawing.Size(16, 16) Me.PictureBox1.TabIndex = 7 Me.PictureBox1.TabStop = False '''' ''''closepanel '''' Me.closepanel.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.closepanel.ForeColor = System.Drawing.Color.Black Me.closepanel.Location = New System.Drawing.Point(240, 64) Me.closepanel.Name = "closepanel" Me.closepanel.Size = New System.Drawing.Size(24, 24) Me.closepanel.TabIndex = 6 Me.closepanel.Text = "关" '''' ''''Label1 '''' Me.Label1.Location = New System.Drawing.Point(24, 8) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(61, 16) Me.Label1.TabIndex = 5 Me.Label1.Text = "查找-可拖" '''' ''''mpreplace '''' Me.mpreplace.Location = New System.Drawing.Point(112, 64) Me.mpreplace.Name = "mpreplace" Me.mpreplace.Size = New System.Drawing.Size(72, 23) Me.mpreplace.TabIndex = 4 Me.mpreplace.Text = "替换" '''' ''''findnext '''' Me.findnext.Location = New System.Drawing.Point(192, 32) Me.findnext.Name = "findnext" Me.findnext.TabIndex = 3 Me.findnext.Text = "下一个" '''' ''''find '''' Me.find.Location = New System.Drawing.Point(112, 32) Me.find.Name = "find" Me.find.Size = New System.Drawing.Size(72, 23) Me.find.TabIndex = 2 Me.find.Text = "查找" '''' ''''rpbox '''' Me.rpbox.Location = New System.Drawing.Point(8, 64) Me.rpbox.Name = "rpbox" Me.rpbox.TabIndex = 1 Me.rpbox.Text = "" '''' ''''txtbox '''' Me.txtbox.Location = New System.Drawing.Point(8, 32) Me.txtbox.Name = "txtbox" Me.txtbox.TabIndex = 0 Me.txtbox.Text = "" '''' ''''formMain '''' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(688, 489) Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1, Me.StatusBar1, Me.comboxSize, Me.comboxFont, Me.ToolBar2, Me.rtbox, Me.ToolBar1}) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Menu = Me.MainMenu1 Me.Name = "formMain" Me.Text = "VB.NET课程设计作业2-写字板:::::By SunnyGroup 2002:::Shanghai Fisheries University:::::" Me.Panel1.ResumeLayout(False) Me.ResumeLayout(False)
End Sub
#End Region
''''声明一个全局boolean变量,用来标记richtextbox中文本变化和保存情况 Dim bSave As Boolean
''''下面这段程序用于对对话框属性和全局变量进行初始化设置 Private Sub formMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ''''为bSave首先赋初值 bSave = True ''''为savefiledialog进行初始化 SaveFileDialog1.FileName = "" SaveFileDialog1.DefaultExt = "txt" SaveFileDialog1.Filter = "Text files (*.txt) |*.txt|All files (*.*) |*.*" SaveFileDialog1.Title = "保存文件.." ''''为openfiledialog进行初始化 OpenFileDialog1.FileName = "" OpenFileDialog1.DefaultExt = "txt" OpenFileDialog1.Filter = "Text files (*.txt) |*.txt|All files (*.*) |*.*" OpenFileDialog1.Title = "打开文件.." ''''下面这段代码是加载当地系统中所有字体到Combobox中 Dim allfonts As FontFamily For Each allfonts In System.Drawing.FontFamily.Families comboxFont.Items.Add(allfonts.Name) Next End Sub
Private Sub rtbox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rtbox.TextChanged ''''文本发生了改变,则将变量bSave置为False bSave = False End Sub
''''******************************************************************************************** ''''字体
''''下面这个函数是用来去除用户指定的字体样式,如加粗,下划线等等 Public Sub RemoveFontStyle(ByVal rtb As RichTextBox, _ ByVal style As System.Drawing.FontStyle) '''' 如果选择文本的长度大于0,将一个一个去除样式。 '''' 这是十分必要的!因为选择的文本中可能有许多不同的样式,而我们的原意是 '''' 保持所有原来的样式,除了那个要被去除的样式 If rtb.SelectionLength > 0 Then Dim selStart As Integer = rtb.SelectionStart Dim selLength As Integer = rtb.SelectionLength Dim currFont As System.Drawing.Font Dim currStyle As System.Drawing.FontStyle
Dim i As Integer For i = 0 To selLength - 1 & 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页 没有相关教程
|