Click here to Skip to main content
15,924,507 members
Home / Discussions / C#
   

C#

 
Questioni want to save a image form serialization.... Pin
maifs26-Sep-08 1:03
maifs26-Sep-08 1:03 
AnswerRe: i want to save a image form serialization.... Pin
Anthony Mushrow26-Sep-08 1:18
professionalAnthony Mushrow26-Sep-08 1:18 
GeneralRe: i want to save a image form serialization.... Pin
maifs26-Sep-08 1:46
maifs26-Sep-08 1:46 
GeneralRe: i want to save a image form serialization.... Pin
c242326-Sep-08 2:03
c242326-Sep-08 2:03 
GeneralRe: i want to save a image form serialization.... Pin
maifs26-Sep-08 2:40
maifs26-Sep-08 2:40 
GeneralRe: i want to save a image form serialization.... Pin
c242326-Sep-08 2:48
c242326-Sep-08 2:48 
GeneralRe: i want to save a image form serialization.... Pin
DaveyM6926-Sep-08 2:54
professionalDaveyM6926-Sep-08 2:54 
GeneralRe: i want to save a image form serialization.... Pin
Mark Salsbery26-Sep-08 6:54
Mark Salsbery26-Sep-08 6:54 
Your code shows nothing related to an image, and as the others stated,
you'll need to create an image to serialize (although your question
is really hard to understand).

System.Drawing.Image is serializable = here's a simple example:
Bitmap bm = new Bitmap(320, 240, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bm);
Pen pen = new Pen(Color.Azure);
g.DrawEllipse(pen, 10, 10, 100, 100);
g.DrawRectangle(pen, 10, 10, 200, 200);
//FileStream fs = new FileStream("c:\\serialized_bitmap.soap", FileMode.Create);
FileStream fs = new FileStream("c:\\serialized_bitmap.dat", FileMode.Create);
//SoapFormatter formatter = new SoapFormatter();
BinaryFormatter formatter = new BinaryFormatter();
try
{
	formatter.Serialize(fs, bm);
}
catch (SerializationException )//e)
{
	//Console::WriteLine( "Failed to serialize. Reason: {0}", e->Message );
	throw;
}
finally
{
	fs.Close();
}

Of course, you'll have to create your Image/Bitmap the way you need to.

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: i want to save a image form serialization.... Pin
maifs26-Sep-08 21:12
maifs26-Sep-08 21:12 
Questionhow to load Pdf file to file test to RichText Box Pin
wasimsharp26-Sep-08 1:02
wasimsharp26-Sep-08 1:02 
AnswerRe: how to load Pdf file to file test to RichText Box Pin
Simon P Stevens26-Sep-08 4:44
Simon P Stevens26-Sep-08 4:44 
AnswerRe: how to load Pdf file to file test to RichText Box Pin
John Ad26-Sep-08 7:40
John Ad26-Sep-08 7:40 
Questiontextbox control managing behaviour of editing content Pin
Witoldek26-Sep-08 0:59
Witoldek26-Sep-08 0:59 
AnswerRe: textbox control managing behaviour of editing content Pin
Anthony Mushrow26-Sep-08 1:22
professionalAnthony Mushrow26-Sep-08 1:22 
QuestionC# reflection? Pin
ppayal26-Sep-08 0:57
ppayal26-Sep-08 0:57 
AnswerRe: C# reflection? Pin
Simon P Stevens26-Sep-08 4:07
Simon P Stevens26-Sep-08 4:07 
QuestionFileStream Pin
kk.tvm25-Sep-08 22:24
kk.tvm25-Sep-08 22:24 
AnswerRe: FileStream Pin
Programm3r25-Sep-08 22:34
Programm3r25-Sep-08 22:34 
GeneralRe: FileStream Pin
kk.tvm26-Sep-08 0:21
kk.tvm26-Sep-08 0:21 
Questionget current instance of visual studio IDE Pin
Vinod C S25-Sep-08 22:22
Vinod C S25-Sep-08 22:22 
QuestionChange registry key in Vista Pin
sarabjs25-Sep-08 22:06
sarabjs25-Sep-08 22:06 
AnswerRe: Change registry key in Vista Pin
Guffa25-Sep-08 22:15
Guffa25-Sep-08 22:15 
AnswerRe: Change registry key in Vista Pin
DaveyM6926-Sep-08 0:41
professionalDaveyM6926-Sep-08 0:41 
QuestionHelp Pls, How to get text from textbox or label on forms with winapi Pin
TALHAKOSEN25-Sep-08 22:04
TALHAKOSEN25-Sep-08 22:04 
AnswerRe: Help Pls, How to get text from textbox or label on forms with winapi Pin
Alan Balkany26-Sep-08 3:05
Alan Balkany26-Sep-08 3:05 

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.