Click here to Skip to main content
15,913,939 members
Home / Discussions / Graphics
   

Graphics

 
QuestionRefresh graphic on screen Pin
cocoonwls30-Apr-08 0:12
cocoonwls30-Apr-08 0:12 
AnswerRe: Refresh graphic on screen Pin
Cedric Moonen30-Apr-08 2:43
Cedric Moonen30-Apr-08 2:43 
GeneralRe: Refresh graphic on screen Pin
cocoonwls1-May-08 15:57
cocoonwls1-May-08 15:57 
GeneralRe: Refresh graphic on screen Pin
cocoonwls1-May-08 22:49
cocoonwls1-May-08 22:49 
GeneralRe: Refresh graphic on screen Pin
Cedric Moonen2-May-08 23:31
Cedric Moonen2-May-08 23:31 
GeneralRe: Refresh graphic on screen [modified] Pin
Baltoro4-May-08 11:41
Baltoro4-May-08 11:41 
GeneralRe: Refresh graphic on screen Pin
cocoonwls4-May-08 20:42
cocoonwls4-May-08 20:42 
GeneralClosing stream after calling Bitmap.Save Pin
jchalfant25-Apr-08 6:20
jchalfant25-Apr-08 6:20 
This is probably a simple problem as the most I've ever done with GDI was a simple ray tracer that drew a circle on a flat plain using drawline ALOT. Needless to say... I'm a GDI nub.

So anyway, I tried to use Bitmap.Save to take a screenshot of each of the windows on a WinForm application. This works great on the first run, but if I run the function a second time an exception is thrown where I called the save.

I decided to use a filestream so I'd have control over the stream instead of passing a pathname. Even though I close the stream when I'm done with it, it throws a file in use exception when I try to create the stream on the second go around.

Here's my current code:
<br />
Bitmap mybmp = new Bitmap(formwidth, formheight,PixelFormat.Format32bppArgb)<br />
//<br />
//code to capture image<br />
//<br />
<br />
System.IO.FileStream fs = System.IO.File.Open(imagePath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);<br />
<br />
mybmp.Save(fs, ImageFormat.Jpeg);<br />
fs.Close();<br />


Am I missing something here?
GeneralRe: Closing stream after calling Bitmap.Save Pin
Mark Salsbery25-Apr-08 7:36
Mark Salsbery25-Apr-08 7:36 
GeneralRe: Closing stream after calling Bitmap.Save Pin
Christian Graus28-Apr-08 14:30
protectorChristian Graus28-Apr-08 14:30 
GeneralLaggy GIF Problem Pin
Reelix24-Apr-08 20:27
Reelix24-Apr-08 20:27 
GeneralRe: Laggy GIF Problem Pin
Randor 28-Apr-08 14:04
professional Randor 28-Apr-08 14:04 
GeneralRe: Laggy GIF Problem Pin
Reelix28-Apr-08 20:49
Reelix28-Apr-08 20:49 
GeneralRe: Laggy GIF Problem Pin
Randor 29-Apr-08 3:59
professional Randor 29-Apr-08 3:59 
GeneralDrawing to Bitmap Pin
cocoonwls20-Apr-08 21:54
cocoonwls20-Apr-08 21:54 
GeneralRe: Drawing to Bitmap Pin
cocoonwls20-Apr-08 23:58
cocoonwls20-Apr-08 23:58 
GeneralReal time video Pin
Chandrias20-Apr-08 4:38
Chandrias20-Apr-08 4:38 
GeneralRe: Real time video Pin
Mark Salsbery21-Apr-08 21:27
Mark Salsbery21-Apr-08 21:27 
Questionis directx installed? Pin
bart00019-Apr-08 5:37
bart00019-Apr-08 5:37 
AnswerRe: is directx installed? Pin
Christian Graus20-Apr-08 11:59
protectorChristian Graus20-Apr-08 11:59 
AnswerRe: is directx installed? Pin
Hamid_RT2-May-08 8:09
Hamid_RT2-May-08 8:09 
General"warp mode image transformation" in photoshop Pin
dapa15-Apr-08 5:06
dapa15-Apr-08 5:06 
GeneralRe: "warp mode image transformation" in photoshop Pin
El Corazon15-Apr-08 6:02
El Corazon15-Apr-08 6:02 
GeneralRe: "warp mode image transformation" in photoshop Pin
Dan16-Apr-08 13:37
Dan16-Apr-08 13:37 
GeneralRe: "warp mode image transformation" in photoshop Pin
dapa17-Apr-08 2:17
dapa17-Apr-08 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.