Click here to Skip to main content
11,495,493 members (64,230 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Multimedia
Hi
I am looking for download able source code.
It must be like:
http://www.codeproject.com/KB/graphics/drawtools.aspx?msg=3668999
That is working perfectly but sadly this project can't save result in JPG or GIF format...

I want a user to create an plain image using rectangles and ellipses and save it in jpg fromat.

Kind regards
Heinrich
Posted 17-Nov-10 20:04pm
Edited 17-Nov-10 20:09pm
JF201553.7K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You could use the project from the link you posted and then use the

drawArea.DrawToBitmap()

method to create a bitmap. This bitmap can then be saved as*.bmp, *.jpg...

Ok,

here is an example:

private void toolStripButtonSave_Click(object sender, EventArgs e)
{
  int w = drawArea.Width;
  int h = drawArea.Height;
  Bitmap bmp = new Bitmap(w, h);
  drawArea.DrawToBitmap(bmp, Rectangle.FromLTRB(0, 0, w, h));
  bmp.Save("C:\\Temp\\test.jpg");
  CommandSave();
}

As you can see I modified the event handler for the "Save" toolbar button. I have tested it and it works fine!
  Permalink  
v2
Comments
heinrich4J at 18-Nov-10 1:50am
   
Problem is that this is in VB and the other code is in C#
Would i still be able to implement it this way?
JF2015 at 18-Nov-10 1:56am
   
If you need this code in VB, then you would need to rewrite it completely since the whole DrawArea control of this project was written in C# and thus can not be easily used with VB. But since you have all the source it should not be that hard.
heinrich4J at 18-Nov-10 2:28am
   
sorry, i think i explainded wrong, i want to keep in in C#, Testing it now
Thanks for the help so far!
heinrich4J at 18-Nov-10 2:34am
   
Could you please add the code in the project and email me the zip? :)
I cant get it to work....(my skills are letting me donw)....
heinrich4J at 18-Nov-10 2:41am
   
heinrichh at gwk.co.za
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Thanks for the reply
how would i use the "drawArea.DrawToBitmap()"
where would it put it in?

kind regards
  Permalink  
Comments
JF2015 at 18-Nov-10 1:46am
   
See my updated answer. And please, if you want to ask something about my answer, post a comment to the answer instead posting an answer to your question - this way I won't be notified of your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 692
1 CHill60 318
2 Sascha Lefèvre 265
3 Nakul Chaudhari 236
4 Sergey Alexandrovich Kryukov 230
0 Sergey Alexandrovich Kryukov 10,322
1 OriginalGriff 8,821
2 Sascha Lefèvre 3,889
3 Maciej Los 3,422
4 Richard Deeming 2,560


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 18 Nov 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100