Click here to Skip to main content
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.3K
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 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 18 Nov 2010
Copyright © CodeProject, 1999-2014
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