Save Bitmap image in a location in C# -


I have this function to store BMP image in the desired location as shown below, how can I save the image I'm in the C: \ Temp folder instead of opening the scope of the file?

I want to specify sd.fileName = picname + ".bmp" and keep it in C: \ temp by default.

I tried

  public static bool save ADBS (string page, 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. Shodilog (!) = Dialog Result. OK) false return; Gide Class; If (GetCodecClsid (sd.FileName, outside clsid)) {MessageBox.Show ("Unknown picture format for extension" + path.gate extension (sd.philname), "image codec", message box button. OK, messagebox icon . information); return false; } IntPtr img = IntPtr.Zero; Int st = GdipCreateBitmapFromGdiDib (bminfo, pixdat, ref IMG); If ((St.! = 0) || (IMG ==InputPro. Zorro)) Returned false; St = GdipSaveImageToFile (IMG, sd.FileName, RefCLCID, EntPTR.Zorro); GdipDisposeImage (img); Returns St == 0; }   

If I understand you correctly, then you use any SaveFileDialog Any all Then I do not suggest you;) You are using SaveFileDialog to retrieve the path of the file which is the SaveFileDialog.FileName in that line

  st = GdipSaveImageToFile (img, sd.FileName , Reef Clinks, IntPtr.Zero);  

Instead of sd.FileName, enter the value you want; I.e, @ "c: \ temp \" + picname + ".bmp"

Remove anything related to SaveFileDialog.


Comments