how to save image and pdf formet in SaveFileDialog?
public static bool SaveDIBAs( string picname, IntPtr bminfo, IntPtr pixdat )
{
SaveFileDialog sd = new SaveFileDialog();
sd.FileName = picname;
sd.Title = "Save bitmap as...";
sd.Filter = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
sd.FilterIndex = 1;
if( sd.ShowDialog() != DialogResult.OK )
return false;
Guid clsid;
if( ! GetCodecClsid( sd.FileName, out clsid ) )
{
MessageBox.Show( "Unknown picture format for extension " + Path.GetExtension( sd.FileName ),
"Image Codec", MessageBoxButtons.OK, MessageBoxIcon.Information );
return false;
}
IntPtr img = IntPtr.Zero;
int st = GdipCreateBitmapFromGdiDib( bminfo, pixdat, ref img );
if( (st != 0) || (img == IntPtr.Zero) )
return false;
st = GdipSaveImageToFile( img, sd.FileName, ref clsid, IntPtr.Zero );
GdipDisposeImage( img );
return st == 0;
}