How can i write in a picturebox?

Posted on 2003-03-24
Medium Priority
Last Modified: 2010-05-01
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.
Question by:Bruja_Yin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

y2ksw earned 200 total points
ID: 8195747
Use the Picture1.Print command. Keep the Picture1.AutoRedraw = True.
LVL 22

Expert Comment

ID: 8196787
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.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question