Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

Using vb.net 2003

 

So I have an app that (1) loads a jpeg into a picture box and (2) using the mouse you can draw lines over the image in the picture box.

 

Now I need help with (3) saving the image AND lines in the picture box to the hard drive.

 

I suspect I need to use fromHbitmap, but i cannot find good reference on how to do this.

 

i have a bitmap var prepared

Dim ThisBitmap As Bitmap

 

i also have the code needed to save the bitmap

ThisBitmap.Save("saved.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

 

i need help between these two commands, where the pixel data in the picture box is somehow stored in a bitmap.

 

thanks,

 

scot

  • *Experts*
Posted

Are you saying the lines dont show up after the image is saved?

If yes then you are probably drawing to the picturebox itself and not the image object it contains to which you have to draw for anything to become the part of the image,

Posted (edited)

Mutant,

 

yes, when i save the image it's an exact copy of the loaded image. the lines do not appear.

 

how would i target the image and not the picturebox?

 

I'll dig further into this.

 

thanks,

 

scot

Edited by scot63
Posted

Ahhh - i see!

 

I was using...

 

dim g as graphics

 

I changed it to...

 

Dim g As Graphics = Graphics.FromImage(P1.Image)

 

Which sends my drawline commands to the image in the picture box (P1).

 

Thanks to you both,

 

Scot

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...