PC Review


Reply
Thread Tools Rate Thread

How to capture form

 
 
Gregory Khra
Guest
Posts: n/a
 
      7th Jan 2008
I use Windows Forms and VS 2005 to draw a plot on the form. How can I save
this plot to a graphics file (preferably jpg)? I couldn't find appropriate
class in the Framework.
Thank you.
Gregory Khrapunovich

 
Reply With Quote
 
 
 
 
CMoya
Guest
Posts: n/a
 
      7th Jan 2008
Look at the Bitmap class. You can transfer your form's Graphics object image
into a Bitmap object. The Bitmap object contains the "Save" methods you're
looking for.

"Gregory Khra" <(E-Mail Removed)> wrote in message
news:068A50C6-6D3E-4A76-BD38-(E-Mail Removed)...
>I use Windows Forms and VS 2005 to draw a plot on the form. How can I save
> this plot to a graphics file (preferably jpg)? I couldn't find appropriate
> class in the Framework.
> Thank you.
> Gregory Khrapunovich
>


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      7th Jan 2008
"Gregory Khra" <(E-Mail Removed)> schrieb:
>I use Windows Forms and VS 2005 to draw a plot on the form. How can I save
> this plot to a graphics file (preferably jpg)? I couldn't find appropriate
> class in the Framework.


Simply use a 'Graphics' object based on an image to draw the plot (air
code):

\\\
Private Overrides Sub OnPaint(ByVal e As PaintEventArgs)
DrawPlot(e.Graphics)
End Sub

Private Sub SavePlot(ByVal FileName As String)
Using Image As New Bitmap(...)
Using g As Graphics = Graphics.FromImage(Image)
DrawPlot(g)
End Using
Image.Save(FileName)
End Using
End Sub

Private Sub DrawPlot(ByVal g As Graphics)
g.DrawLine(...)

' Drawing code.
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to capture my form =?Utf-8?B?R3JlZ29yeSBLaHJh?= Microsoft Dot NET Framework Forms 1 12th Apr 2007 09:38 PM
How can i capture name of a form? =?Utf-8?B?cnVwZXJ0c2xhbmQ=?= Microsoft Access Form Coding 3 14th Jun 2006 12:16 PM
Using Add button to capture data in form and recreate form =?Utf-8?B?QWxp?= Microsoft Access Form Coding 0 10th Jun 2005 05:35 PM
Capture NT username for form =?Utf-8?B?Q2FmZmU=?= Microsoft Access Security 3 2nd Jun 2005 05:21 PM
Form Capture Viktor Microsoft C# .NET 1 30th Sep 2004 12:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:56 PM.