Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my C# application, I would like to launch the default image editor to edit an image.

When I'm using System.Diagnostics.Process.Start("C:\image.png") it opens the image file using the Windows Photo Viewer.

When I right-click on the image file in Windows Explorer, there is a "Edit" menu item which launches Microsoft Paint (by default). I would like to do the same in my application (i.e. open the file using the default image editor).

I don't want to hardcode MS Paint by doing Process.Start("mspaint.exe C:\image.png"). I would prefer to use the default image editor program set by the user (which can be different from MS Paint).

Is there a way to do this?

Thanks Frank

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
426 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can try starting a process with a verb edit.

ProcessStartInfo startInfo = new ProcessStartInfo("C:\image.png");
startInfo.Verb="edit";

Process.Start(startInfo);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...