Link to home
Start Free TrialLog in
Avatar of Bruja_Yin
Bruja_Yin

asked on

How can i write in a picturebox?

I am makking a program interpreter for a language and when the user wants to write something on the screen, it has to appear in a picturebox.
ASKER CERTIFIED SOLUTION
Avatar of y2ksw
y2ksw

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think you may be looking for a way to let the user draw things onto the picturebox?

Try this:

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = vbLeftButton Then
    Picture1.PSet (X, Y), vbBlack
  End If
End Sub

When the user "drags" the mouse with the left button down, pixels will be draw at the intercepted mouse positions within the picturebox.

(And to retain this info when another form moves across the window, use Autoredraw as indicated in the previous comment.)

To "store" the drawm image:

savepicture picture1.IMAGE, "C:\test.bmp"

And to transfer to another picture container, use the image property of the picturebox, not the picture property.