Option Explicit
Private Sub Command1_Click()
'显示文字
Dim s As String
s = "显示文字"
Dim i As Long
Dim x As Single, y As Single
Me.Font.Size = 256
Me.ForeColor = RGB(255, 255, 0)
x = (Me.ScaleWidth - Me.TextWidth(s)) / 2
y = (Me.ScaleHeight - Me.TextHeight(s)) / 2
Me.CurrentX = x
Me.CurrentY = y
Me.Print s
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'在属性里设置 BorderStyle = 0
,此属性运行时设置无效
Me.BackColor = RGB(0, 255, 128)
Me.WindowState = 2
End Sub
还有一种控件的方法,就是放个Label 控件,设为透明色,上下在窗体中居中,左右与窗体等宽。
控件属性:字号,可以放到很大,设置字色,文字对齐方式为居中。
把需要显示的内容直接输入进去,该控件会自动左右居中