用vb创建一个应用程序,要求使用print方法在窗体中央显示一行文字

来源:百度知道 编辑:UC知道 时间:2024/06/17 07:48:25

Private Sub Form_Click()
Dim l As Integer
Dim h As Integer
Dim i As Integer
Dim s As String

s = "你好"
Me.ScaleMode = 4
l = Me.ScaleWidth
h = Me.ScaleHeight
h = h / 2
l = l / 2
For i = 1 To h + 1
Print
Next i
For i = 1 To l
Print " ";
Next i
Print s
End Sub

s = "你好"
CurrentX = (ScaleWidth - TextWidth(s)) / 2
CurrentY = (ScaleHeight - TextHeight(s)) / 2
Print s