Open image from PictureBox in Windows Photo Viewer c#

  • 286 Views
  • Last Post 04 September 2018
  • Topic Is Solved
Stylus STYLUS posted this 04 September 2018

I find this solution

I have picture saved in database and retrieved from database in picture box...that working fine.

I need to show that picture in picture and fax viewer

Error is : The system can't find file specified

Some help?

private void button12_Click(object sender, EventArgs e)
        {
            Process photoViewer = new Process();
            photoViewer.StartInfo.FileName = @"c:\\testImage.jpg";
            photoViewer.StartInfo.Arguments = @"c:\\testImage.jpg";
            photoViewer.Start();
        }
Order By: Standard | Newest | Votes
Stylus STYLUS posted this 04 September 2018

This solution is ok, how to define PathOfFile?

Help

Process.Start("C:\windows\system32\rundll32.exe", "C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen " & PathOfFile);
Stylus STYLUS posted this 04 September 2018

Solved

string myPictures = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
string myPath = System.IO.Path.Combine(myPictures, "testImage.jpg");

dataPictureBox.Image.Save(myPath, System.Drawing.Imaging.ImageFormat.Jpeg);

// Use default image viewer
System.Diagnostics.Process.Start(myPath);

// Use image viewer application indicated by the variable "myImageViewer"
//System.Diagnostics.Process.Start(myImageViewer, myPath);
Daniel Soares posted this 04 September 2018

When using @ before string declarations, the double bars (\\) are not needed anymore, just one (\).

Close