[RESOLVED] Positioning text in picturebox
Hello, does anybody know how to position text (X and Y) so that the complete text always stays in the picturebox and on the right bottom side, no matter what size the picturebox has and no matter what font name and size is used?
Thank you.
http://img235.imageshack.us/img235/9631/pic1ea8.jpg
http://img235.imageshack.us/img235/5914/pic2ts6.jpg
VB Code:
Private Sub Command1_Click()
Pic.FontName = "Arial"
Pic.ForeColor = vbWhite
Pic.FontBold = True
Pic.FontSize = 12
Pic.CurrentX = '??????
Pic.CurrentY = '??????
Pic.Print "Testing"
End Sub
Re: Positioning text in picturebox
Try this quicky:
VB Code:
Private Sub Command1_Click()
Dim strText$
strText = "Hello World"
With Picture1
.AutoRedraw = True
.Font.Size = 20
.Font.Name = "Arial"
.CurrentX = .ScaleWidth - .TextWidth(strText)
.CurrentY = .ScaleHeight - .TextHeight(strText)
Picture1.Print strText
End With
End Sub
Re: Positioning text in picturebox
You'd need to cut the text length in half first, otherwise it's still going to be skewed...
Re: Positioning text in picturebox
That works great. Thank you :)
Re: [RESOLVED] Positioning text in picturebox