Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

581 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