Opening graphics in mspain

Berkil

Newcomer
Joined
Oct 14, 2009
Messages
4
Is it possible to open a System.Drawing.Graphic Image in paint without having to save it first ?.. If not would it be possible to save the file temporarily, use it and then discard it again ?

this code requires a specific file and can't take an Image created with Graphics:
Code:
  Process.Start("mspaint.exe");
 
I doubt you can use paint to open the image without saving it first. When you create the temporary file and launch paint, you can handle the Process.Exited event so you know when paint has closed.

If you want to delete the file, there is a certain way you will need to load it. Load the file into memory with File.ReadAllBytes, then create a memory stream on the array and pass it to Image.FromStream(). Image.FromFile() will keep the file open until it is disposed, so you wouldn't be able to delete it.
 
Back
Top