C#windows 7保存图片而不显示保存文件对话框 [英] C# windows 7 save picture without showing save file dialog

查看:134
本文介绍了C#windows 7保存图片而不显示保存文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好家伙

i我尝试不使用文件对话框保存图片

duing我在我的电脑上编译代码,Windows 7

图片保存没有显示文件对话框



但是在我在其他电脑上安装我的应用程序后,Windows 7

它会一直显示文件对话框。

我可以知道如何删除该文件对话框吗?



我尝试过:



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);

推荐答案

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.


这篇关于C#windows 7保存图片而不显示保存文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆