|
-
Oct 13th, 2003, 07:04 AM
#1
Thread Starter
Member
GDI+ Save Image
Hi,
I’m new to VB.NET
Q - How can I save an image drawn on picturebox ?
In VB 6 when we draw lines and shapes on picture box we used use Image property to get Image on the picture box
In .NET we have only one “Image” property instead of “picture” and “image” properties that will give only Background picture of Picture box not the Image on Picture box
I’ve tried this -- created an image and drew all the things on the image and finally set Picture box image property to this image, This causing problems that it is always erasing last image(I think certainly this is the wrong way)
I’m working on small designing application like paint
(sorry for my poor English)
Thanks in advance
-
Oct 13th, 2003, 12:07 PM
#2
I wonder how many charact
Not really sure about your problem.
Maybe you want to save the images in an ImageList.?
So then you can refer back to previous images...
VB Code:
'create image container
Dim myList As new ImageList
'add current picturebox image to container list
myList.Images.Add(Me.picturebox1.Image)
'clear the current picturebox image from the picturebox
Picturebox1.Image = Nothing
Messagebox.Show("Abra Cadabra")
'set the image in the container to the picturebox
PictureBox1.Image = myList.Images(0)
-
Oct 13th, 2003, 02:07 PM
#3
Re: GDI+ Save Image
well if I understand correctly, you have some things drawn in the picturebox and you want to draw some other things over that, right? if you want to do that, you can create an image from whatever you have in the picturebox, then draw on that image
I dont have VS.NET to test it right now, hope this works fine:
VB Code:
dim bmp as bitmap
' Originally the image property if set to nothing, when no picture is inside
if myPictureBox.image is nothing then
bmp = new bitmap (myPictureBox.Width, myPictureBox.height)
else
bmp = new bitmap (myPictureBox.image)
end if
dim gr as graphics = graphics.fromImage(bmp)
bmp.draw....
gr.dispose() 'hmm I'm not sure if this is really needed, someone tell me plz :D
myPictureBox.image = bmp
should work
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Oct 14th, 2003, 05:30 AM
#4
Thread Starter
Member
Hi MrPolit
Thanks for your Asnwar
Thats exacltly what I need
I'll try that
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|