richtextbox设置字体居中后为什么会改变
Private Sub Timer1_Timer()
RichTextBox1(0).Text = Second(Time)
If RichTextBox1(0).Text = "30" Then
Dim s1 As String
Open "E:\yangle\ZZ.txt" For Input As #1
Line Input #1, s1
Close #1
RichTextBox1(1).Text = s1
End If
End Sub
Private Sub Form_Load()
For i = 0 To 9
RichTextBox1(i).Text = "----"
RichTextBox1(i).SelStart = 0
RichTextBox1(i).SelLength = Len(RichTextBox1(i).Text)
Next
For i = 0 To 9
RichTextBox1(i).Font.Bold = True
RichTextBox1(i).BackColor = &H80000018
RichTextBox1(i).SelAlignment = 2
RichTextBox1(i).SelColor = RGB(0, 0, 255)
Next
Text1.Text = Len(RichTextBox1(0).Text)
End Sub
初始化的时候还是居中,执行timer控件后就变回左对齐了,这是为什么啊???
[解决办法]
执行RichTextBox1(0).Text = Second(Time)时RichTextBox1(0)原文本已清除,初始化的时候的居中设置已不起作用.
[解决办法]
RichTextBox1(0).SelAlignment = 2'居中 RichTextBox1(0).Text = Second(Time)
[解决办法]
上面搞反了,应为:
RichTextBox1(0).Text = Second(Time) RichTextBox1(0).SelAlignment = 2