gayathri_gopi
06-23-2004, 03:26 AM
//dlg1.Filename is a metafile
Metafile mf=new Metafile(dlg1.FileName,ipHdc);
ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,ImageFormat.Emf, ImageFormat.Jpeg, ImageFormat.Png, ImageFormat.Tiff };
grfx.ReleaseHdc(ipHdc);
grfx = Graphics.FromImage(mf);
grfx.DrawImage(bm, 0, 0, cx, cy);
grfx.Dispose();
try
{
mf.Save(dlg1.FileName,aif[2]);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Text);
}
In this program of converting a bitmap to a metafile,the above code creates a metafile before using the mf.save line.
But the size of metafile is larger than the original bmp.
The mf.Save method creates a metafile but,with some exception,
"A generic error occured in GDI+".
while displaying the type of that file using GetType(), it returns bitmap.
I need to know first, whether a metafile is lesser in size than a bitmap.
if so, how can i convert a bitmap to a metafile?
My program , till before the line mf.save(....), creates metafile with
a size larger than the bitmap i specified.
So any body, please help em out.
Metafile mf=new Metafile(dlg1.FileName,ipHdc);
ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,ImageFormat.Emf, ImageFormat.Jpeg, ImageFormat.Png, ImageFormat.Tiff };
grfx.ReleaseHdc(ipHdc);
grfx = Graphics.FromImage(mf);
grfx.DrawImage(bm, 0, 0, cx, cy);
grfx.Dispose();
try
{
mf.Save(dlg1.FileName,aif[2]);
}
catch (Exception exc)
{
MessageBox.Show(exc.Message, Text);
}
In this program of converting a bitmap to a metafile,the above code creates a metafile before using the mf.save line.
But the size of metafile is larger than the original bmp.
The mf.Save method creates a metafile but,with some exception,
"A generic error occured in GDI+".
while displaying the type of that file using GetType(), it returns bitmap.
I need to know first, whether a metafile is lesser in size than a bitmap.
if so, how can i convert a bitmap to a metafile?
My program , till before the line mf.save(....), creates metafile with
a size larger than the bitmap i specified.
So any body, please help em out.