Add Text to PictureBox?

ErikL

New member
Joined
Jan 22, 2007
Messages
4
Programming Experience
3-5
Hey,

I am writing a program that is using a Windows CE device to capture an image. I have the capture device mapped to a Picturebox and everything is working great.

However, I am trying to add text to the picture box to display the date and time of the capture for saving (like a date/time stamp). I am stuck as to how to complete this.

Any ideas?

Regards,
Erik
 
In the picture box is an image right? A bitmap to be precise. So get a handle to a graphics object for the image...

VB.NET:
Dim G as graphics = graphics.fromimage(picturebox.image)


You can then draw what you like on it, in your case the 'DrawString' method is what you are looking for.
 

pbControlViewer.Image =
New System.Drawing.Bitmap(imageStream)

Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(pbControlViewer.Image)

g.DrawString(Now, drawFont, drawBrush, 0, 0)

---

No luck. Is there something else I have to put in?
 
I figured it out.
The drawString() worked. That said, it has to convert the JPG into a BMP in order for me to use the drawString() and save it. Although the format is .jpg, the size is more like a BMP.

Is there anyway to open a .bmp and convert it to a .jpg?

Also, after the capture is done, I am trying to get the image to post back into a PictureBox for viewing on the handheld device. In setting the image property to load the new filename, it produces an image out of scale with the box. How can I force the picturebox to rescale the image?

Thanks!
Erik
 
Back
Top