CodeItBetter Programming Another VB Programming Blog

How to center the Text in a picture box?

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
'Controls - How to center the Text in a picture box?
'Insert a picture box and a command button on your form

Private Sub Command1_Click()
    Const MYTEXT = "I'm centered"
    Picture1.CurrentX = (Picture1.Width / 2) - (TextWidth(MYTEXT) / 2)
    Picture1.CurrentY = (Picture1.Height / 2) - (TextHeight(MYTEXT) / 2)
    Picture1.Print MYTEXT
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.