Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgrade problem from vb6 to vb.net 1

Status
Not open for further replies.

Horowitz

Programmer
Jan 29, 2005
30
GR
Hi all,

In vb6 i'd write:

Picture1.CurrnetX = 200
Picture1.CurrnetY = 200
Picture1.print "Hello and thanks for your help."

In vb.net how should print a message in a picturebox? The CurrentX and Y methods, as well as the print method do not exist...

Any help for that?
 
To print text in a picture box you first need the graphics object to print to:
Code:
Dim g As Graphics = PictureBox1.CreateGraphics()

An example would be the following:
Code:
Dim g As Graphics = PictureBox1.CreateGraphics()
Dim b As Brush = Brushes.Black
Dim x As Single = 1
Dim y As Single = 2
g.DrawString("String to draw", New Font("Arial", 12, FontStyle.Bold), b, x, y)

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top