eltel2910
eltel2910

Reputation: 345

Process Start to open image file in resources folder

I have a C# program that I need to embed an image into or perhaps better stated make the exe file portable such that the image will open on any computer and I need the image to open up in the default picture viewer (not a form PictureBox). I do have the image in the resource folder with 'Embed Resource'

System.Diagnostics.Process.Start = WindowsFormsApplication5.Properties.Resources.MyImage;

I realize the above code is invalid, but I am just a coding hobbyist, so I don't know everything. If I could get a little push in the right direction, I would appreciate it.

Upvotes: 2

Views: 1789

Answers (1)

Mohit S
Mohit S

Reputation: 14064

This might do the trick for you but If you want a Default Image Viewer to open a picture, you need to store that image to somewhere on your disk, thus the Image Viewer could find and open your picture.

var bitmap = new Bitmap(WindowsFormsApplication5.Properties.Resources.MyImage);
bitmap.Save("YourImageLocation");
Process.Start("YourIamgeLocation");

Upvotes: 3

Related Questions