查找一次后記入查找內容的位置,百查找下一個功能度 這時候的開始位置就是剛才查找內容的位置加上查找內容的長度,版突出顯示其實就是選權定文本,富文本框有SelectionStart,SelectionLength 兩個屬性
創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供湯原網站建設、湯原做網站、湯原網站設計、湯原網站制作等企業(yè)網站建設、網頁設計與制作、湯原企業(yè)網站模板建站服務,十多年湯原做網站經驗,不只是建網站,更提供有價值的思路和整體網絡服務。
你是說記事本的配置吧,
如果設置不是太大,可以保存在注冊表中,
另外可以用xml文件或者ini文件來保存配置,
不知道有沒理解錯你的意思
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.ShowDialog()
RichTextBox1.LoadFile(Me.OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim fname As String
Me.SaveFileDialog1.ShowDialog()
fname = Me.SaveFileDialog1.FileName
If (fname "") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(fname, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(fname, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.SaveFileDialog2.ShowDialog()
If (Me.OpenFileDialog1.FileName "") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog2.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog2.FileName, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.FontDialog1.Font = Me.RichTextBox1.SelectionFont
If (Me.FontDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.ColorDialog1.Color = Me.RichTextBox1.SelectionColor
If (Me.ColorDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionColor = Me.ColorDialog1.Color
End If
End Sub
Private Sub 打開ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 打開ToolStripMenuItem.Click
Try
Dim str As String
Dim typel As System.Windows.Forms.RichTextBoxStreamType
OpenFileDialog1.ShowDialog()
str = OpenFileDialog1.FileName
RichTextBox1.LoadFile(str, RichTextBoxStreamType.PlainText)
Catch ex As Exception
End Try
End Sub
Private Sub 保存ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 保存ToolStripMenuItem.Click
Me.SaveFileDialog1.ShowDialog()
If (Me.SaveFileDialog1.FileName "") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
End If
End If
End Sub
Private Sub 另存為ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 另存為ToolStripMenuItem.Click
Me.SaveFileDialog1.ShowDialog()
If (Me.OpenFileDialog1.FileName "") Then
If (Me.OpenFileDialog1.FilterIndex = 1) Then
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
Else
Me.RichTextBox1.SaveFile(Me.SaveFileDialog1.FileName, RichTextBoxStreamType.RichText)
End If
End If
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 字體ToolStripMenuItem.Click
Me.FontDialog1.Font = Me.RichTextBox1.SelectionFont
If (Me.FontDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionFont = Me.FontDialog1.Font
End If
End Sub
Private Sub 顏色ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 顏色ToolStripMenuItem.Click
Me.ColorDialog1.Color = Me.RichTextBox1.SelectionColor
If (Me.ColorDialog1.ShowDialog() = Me.DialogResult.OK) Then
Me.RichTextBox1.SelectionColor = Me.ColorDialog1.Color
End If
End Sub
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
End Sub
End Class
一、用wshshell組件的RegWrite方法寫注冊表,在HKEY_CLASSES_ROOT\*\Shell 位置加入的你程序,
例如:
[HKEY_CLASSES_ROOT\*\shell\我的程序\command]
@="D:\\我的程序.exe %1"
后面的%1會將文件名傳送給你的程序的Command$,多文件名需要使用DDE方式進行互斥傳入。
二、
將下面內容輸入記事本后保存為reg文件,運行即可:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\OpenInNotepad]
@="用記事本打開"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\OpenInNotepad\command]
@="notepad.exe %1"
"用記事本打開" 為右鍵菜單中顯示的名稱