|
-
Oct 31st, 2003, 04:40 AM
#1
Thread Starter
Frenzied Member
Saving image created with System.Drawing.Graphics [resolved]
I am currently combining 2 images with each other with an System.Drawing.Graphics object.... but once i have done that i want to save the image but i cant seem to get an image from the .image or .backgroundimage property :s
this is my code
VB Code:
Dim g As System.Drawing.Graphics = PictureBox3.CreateGraphics
g.DrawImage(PictureBox2.Image, 0, 0)
g.DrawImage(PictureBox1.Image, 0, 0)
g.Save()
g.Dispose()
PictureBox4.Image = PictureBox3.Image ' nothing happens here
putting it on another image is just a test to see if it worked.. ofcourse i know that i should save through the bitmap object
any help would be nice
Last edited by Ultimasnake; Nov 3rd, 2003 at 08:34 AM.
-
Oct 31st, 2003, 08:28 PM
#2
Addicted Member
"And most of the evils of society can, in fact, be cured through information. We have a society that has been disinformed and based on the disinformation has made irrational choices. And that's what I mean by 'ignorance.' People, who ordinarily might be smart, are deprived of the data by which to make a rational decision, don't have the data to do it."
Frank Zappa
-
Nov 1st, 2003, 07:34 AM
#3
Thread Starter
Frenzied Member
-
Nov 1st, 2003, 08:08 AM
#4
when you create the PictureBox3.Image using graphics from the first 2 pictureboxes, the image is a " Virtual " image and not actually PictureBox3.Image ( if you tried saving PictureBox3.Image , you would probably find it saved a blank image, not the picture you see in the box )
you would be best first creating the Image as an Image / Bitmap , then doing something like PictureBox3.Image = image
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 3rd, 2003, 03:22 AM
#5
Thread Starter
Frenzied Member
uhm ok but the image/bitmap property doesnt have a creategrapics option... so how and where to use it precisely :S
-
Nov 3rd, 2003, 04:10 AM
#6
like this ...
VB Code:
[color=blue]Dim[/color] img [color=blue]As[/color] Image = Image.FromFile("C:\tester.bmp")
[color=blue]Dim[/color] grp [color=blue]As[/color] Graphics = Graphics.FromImage(img)
[color=blue]With[/color] grp
.DrawString("some string of text", [color=blue]New[/color] Font("Tahoma", 10, FontStyle.Bold), [color=blue]New[/color] SolidBrush(Color.Blue), 20, 20)
[color=blue]End With[/color]
PictureBox1.Image = img
PictureBox1.Image.Save("C:\a_Bitmap.bmp")
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 3rd, 2003, 04:17 AM
#7
Thread Starter
Frenzied Member
Dim img As Image = Image.FromFile("C:\tester.bmp")
/\
how can i do this with a blank image only?
-
Nov 3rd, 2003, 06:29 AM
#8
if you want to start with a blank image...
VB Code:
[COLOR=blue]Dim[/COLOR] bmp [COLOR=blue]As New[/COLOR] Bitmap(200,200) [COLOR=green]'/// where 200 is the size , your size goes there.[/color]
[COLOR=blue]Dim[/color] grp [COLOR=blue]As[/color] Graphics = Graphics.FromImage(bmp)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 3rd, 2003, 07:33 AM
#9
Thread Starter
Frenzied Member
works like a glove... only 1 problem
the height and width should be taken from set variables... and this doesnt seem to work :
VB Code:
Dim bmp As New System.Drawing.Bitmap(x_width, x_height)
so how the . can i do that? tried to set .height and .width afterwards but that doesnt seem to work
-
Nov 3rd, 2003, 08:34 AM
#10
Thread Starter
Frenzied Member
nevermind found it out ...
VB Code:
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width, Height)
thanks for the help dynamic_sysop
-
Nov 3rd, 2003, 08:53 AM
#11
no problem , geode middag
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Nov 3rd, 2003, 09:10 AM
#12
Thread Starter
Frenzied Member
nederlands? :P
(translation)
dutch? :P
-
Nov 3rd, 2003, 09:21 AM
#13
ja maar ik heeft in engeland gewoonde voor 27 jaar, so mij nederlandse is niet goede
i originally come from a place called Almelo in holland.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
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
|