vb中如何记录richtextbox的进度

来源:百度知道 编辑:UC知道 时间:2024/05/21 16:00:09
VB菜鸟
我用richtextbox做了看一个指定txt文件的浏览器
代码如下:
Dim a As String
Dim n As Integer
Private Sub Command1_Click()
MsgBox "多谢观看"
End
End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
End Sub
Private Sub Form_Load()
Randomize
RichTextBox1.LoadFile App.Path & "\" & "fate.txt"
End Sub
Private Sub mbcolor_Click()
n = Int(Rnd * 16)
RichTextBox1.BackColor = QBColor(n)
End Sub
Private Sub mbig_Click()
RichTextBox1.SelFontSize = RichTextBox1.SelFontSize + 2
End Sub

Private Sub mcolor_Click()
n = Int(Rnd * 16)
RichTextBox1.SelColor = QBColor(n)
End Sub
Private Sub msmall_Click()
RichTextBox1.SelFontSize = RichTextBox1.SelFontSize - 2
End Sub
由于这txt很长,请问有简单的办法可以记录前一次看的进度吗?
同时我这增大缩小字体的代码需要用鼠标选定本文,有简单的办法可以直接让他全文增大或缩小吗??
谢谢各位指教

第一个问题没有好的想法。
第二个的话可以用一个笨办法

RichTextBox1.SetFocus
SendKeys "^{a}"
然后再执行你的增大缩小

Private Sub Form_Unload()
open "a" for output as #1
print #1,RichTextBox1.SelStart
close #1
end sub
Private Sub Form_load()
dim aasdf as string
open "a" for input as #1
input #1,a
close #1
RichTextBox1.selstart=val(aasdf)
end sub