傻瓜问题,怎么使想要输到图片框的字居中显示?
学习编程遇到点小问题,请教下各位大侠,小弟写了如下程序想让要输入的“你好”居中显示,结果字却显示在图片框右下角的位置,经过多次尝试,发现如果把picture1.fontsize=48这一行去掉就居中了,可是怎么能让字保持48号大小又居中显示呀?
Private Sub Form_Click()
Dim txth As Integer, txtw As Integer
Picture1.FontSize = 48
Picture1.ForeColor = RGB(255, 0, 0)
txth = TextHeight("你好")
txtw = TextWidth("你好")
Picture1.Print "你好"
Picture1.CurrentX = (Picture1.ScaleWidth - txtw) / 2
Picture1.CurrentY = (Picture1.ScaleHeight - txth) / 2
Picture1.Print "你好"
End Sub