使用C#设置MS绘图的默认保存位置 [英] Set default save location of MS paint using C#

查看:119
本文介绍了使用C#设置MS绘图的默认保存位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在C#中有一个Web应用程序。我的要求:在按钮点击事件中,我需要从本地文件夹(

Hi,

I have a web application in C#. My Requirement : In button click event, i need to open an image from a local folder (

C:\temp\image35.jpg

)打开图像并编辑并保存在共享文件夹。在绘画保存期间,我需要默认设置位置。



我使用下面的代码在绘画中打开图像。但是,在保存期间无法设置位置路径。



请帮忙。



我尝试过:



) and edit and save it in a shared folder. During save in paint, i need to set the location by default.

I used the below code to open the image in paint. but, not able to set the location path during save.

Please help.

What I have tried:

System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(@"C:\temp\image35.jpg");
          procInfo.Verb = "edit";

          System.Diagnostics.Process.Start(procInfo);

推荐答案

嗯。

那不行。 C#代码在服务器而不是客户端上运行 - 当您使用C#代码中的Process.Start时,进程在服务器上启动并运行,而不是在客户端上运行,并且无法访问客户端文件系统。

它可能似乎适用于您的开发系统,因为客户端和服务器是相同的物理机器,但在生产中从来就不是这样但它失败了。



即使它确实有效 - 它不会,你也不能强迫应用程序在客户端机器上运行 - 你无法控制它的保存位置,原因很多,其中一个这是:您不知道将打开哪个应用程序来编辑该文件。在您的计算机上它可能是油漆。我的是Corel Paintshop Pro X9。在我的Android平板电脑上,我不知道,至于在互联网连接冰箱的Apple设备上可能会发生什么,我不想推测。



找到更好的解决方案:你不能做你正在尝试的事情。
Um.
That won't work. C# code runs on the Server, not the Client - and when you use Process.Start from C# code the process starts and runs on the Server, not on the Client, and has no access whatsoever to the Client file system.
It might appear to work on your development system because the Client and the Server are the same physical machine, but in production that is never the case and it fails.

Even if it did work - which it won't, you can't force an app to run on a client machine at all - you can't control where it is saved, for a huge number of reasons, one of which is: you have no idea what application will open to edit the file. On your computer it may be Paint. On mine it would be Corel Paintshop Pro X9. On my Android Tablet, I have no idea, and as for what the heck might happen on an Apple device of an internet connected fridge I don't want to speculate.

Find a better solution: you cannot do what you are trying.


这篇关于使用C#设置MS绘图的默认保存位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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