Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello guys
i am try to save picture without using file dialog
duing i compile my code at my computer, windows 7
the picture is save without showing file dialog

but after i install my aplication on other computer, windows 7
it keep showing file dialog.
can i know how to remove that file dialog?

What I have tried:

_pathLoc = "C:\\bookbar\\Book Borrowed Record\\Form " + formNumber + "\\" + formName ;

if (!Directory.Exists(_pathLoc)) {
// create path location if the path string doesn't exist
Directory.CreateDirectory(_pathLoc);
}

_imagePath = _pathLoc + "\\" +studentName + ".jpeg";


// create image of list of barcode already created
           var bmp = new Bitmap(Width, Height, CreateGraphics());
           DrawToBitmap(bmp, new Rectangle(0, 0, Width, Height));
           e.Graphics.DrawImage(bmp, 0, 0);

           // save the image
           bmp.Save(@_imagePath, System.Drawing.Imaging.ImageFormat.Jpeg);
Posted
Updated 31-Oct-18 20:39pm
v2
Comments
Richard MacCutchan 1-Nov-18 5:34am    
It cannot show the save dialog unless you have coded it into your application.

1 solution

Your code is correct, check the value of @_imagePath and just try below line to save your image for verification.

bmp.Save("C:\\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); 

and then put your variable instead of hard code filename value.
 
Share this answer
 
v2
Comments
newbie1992 1-Nov-18 2:37am    
hi, i already check my code
i don't think there is any problem with my variable

i forgot to include it in this question cause it was in different line of code

here is the sample code

_pathLoc = "C:\\bookbar\\Book Borrowed Record\\Form " + formNumber + "\\" + formName ;

if (!Directory.Exists(_pathLoc)) {
// create path location if the path string doesn't exist
Directory.CreateDirectory(_pathLoc);
}

_imagePath = _pathLoc + "\\" +studentName + ".jpeg";
Niraj Gajjar 1-Nov-18 7:58am    
Can you please show the value of _imagePath variable ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900