(1)在设计时,将TextBox的Aligment属性设置为 2 - Center,如下图示
(2)或者,在窗体代码中
Option Explicit
Private Sub Form_Load()
'设置Text1居中
Text1.Alignment = 2
End Sub
文字居中:Text1.Alignment = vbCenter
补充:
文字靠左:Text1.Alignment = vbLeftJustify
文字靠右:Text1.Alignment = vbRightJustify
Text1.Alignment = 2