Unknown File Format - how to solve
Hi;
I use the method below to save an image showed in a Picture Box using the SaveFileDialog.
protected void SaveImage()
{
try
{
Stream stream = File.OpenWrite (this.CaminhoImagem);
using (StreamWriter writer = new StreamWriter (stream))
{
writer.Write (this.pctImagem.Image.Clone ()); }
}
catch (IOException ex)
{
MessageBox.Show (ex.Message, "Harpia - Erro de Gravação",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}//final do metodo
The method running very well and don't show me any error.
Is impossible to open the saved image because the image format is wrong. Always i'm seeing the message: "UNKNOWN FILE FORMAT".
How can i solve this problem???
|