Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
i have one windows form with a button.when i click the button a graph is to be displayed.
 
A separate class has been created for creating a graph..with all member functions.
 
i call this class through the form.when button is triggered...the graph class is supposed to run.now...
final image is created..i can make out using breakpoints..
 
but i am unable to display the image...
 
line2d is the calss...line2d.getgraph is the function gor getting a graph.
how will i get it in form using memory stream..
 
an example from codeproject froums is give ..plz refer to LineChart application.but user used webforms for displaying final image...the last 2 lines of the apllication are given below.
Bitmap bmp = line2d.GetGraph();
bmp.Save(Response.OutputStream,ImageFormat.Jpeg);
Posted 10-Feb-13 19:37pm
Edited 10-Feb-13 21:27pm
v3
Comments
Sergey Alexandrovich Kryukov at 11-Feb-13 1:49am
   
Not clear. Could you use "Improve question" above?
—SA
Guirec Le Bars at 11-Feb-13 5:55am
   
simply replace 'Response.OutputStream' by a variable you will declare as new MemoryStream();
then you can uset the newly created stream to save the file to disk and render it in a windows form.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The Bitmap.Save method accepts the stream object or file path to which the bitmap is to be saved.
In your last line of code replace 'Response.OutputSream' to MemoryStream object if you want to save in memory file or pass the temporary file path where you can save the image.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 878
1 OriginalGriff 410
2 CPallini 275
3 George Jonsson 226
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,482
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 11 Feb 2013
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