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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add text to image in picturebox

Status
Not open for further replies.

boroarke

Technical User
May 13, 2003
5
US
I'm still pretty new to programming so please bare with me and any help that can be offered is greatly appreciated. I have a program in which the user loads an image which is displayed in a picturebox. The user can then print this image from their printer. I would like to add controls which will allow the user to click anywhere in the picture box and then type text which will be printed on the image when the image is later printed. I would like the user to be able to select the font from a list of fonts already installed on the users PC as well as the size of the font and the color. Once the text is typed, id like the user to have the ability to click the text and be able to move it, edit it or delete it.

Is this something that would be fairly simple to do? Any one know of a tutorial or guide that will walk me through the process of doing something like this? Thanks in advance for any help!

Bryan
 
Sounds like what you are describing is a very simple image editor. This is possible to do in VB, I did my project on this in my final year at college. I basically created a cut-down version of PaintShopPro a popular graphics program at the time.

I should that this isn't as simple as it sounds either, I'll have a look for my old code and see if i can post from excerpts to get you started.

A,
 
Unfortunately My old project code was in VB3 and I wasn't unable to open it in VB6, I'm a bit gutted about that.

However if my memory serves me correctly (it has been 10 years since I did this!) you can use the PictureBox control and 'draw' your text (or whatever you want) on to it, making sure to set AutoRedraw to true (so changes show up on the screen).

You can capture the position of the cursor inside the picturebox to know where to position your text, or color a pixel to simulate a drawing package for instance. Then you can either copy the image to the clipboard or save it to a bitmap file (you'll need to look up the code to do this I don't remember it).

I hope this at least gives you a starting point to work from.

A,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top