C # calls the computer's default picture browser software to open the picture

Source: Internet
Author: User

The private void Call window displays Toolstripmenuitem_click (object sender, EventArgs e) {string filepathname = "";//defines the location of the image file (including Path and file name) OpenFileDialog ofd = new OpenFileDialog (); Add Open dialog Box OFD.  Filter = "image file |*jpg;*.bmp;*.png,*.tif| all files |*.*"; Set the filter if (OFD. ShowDialog () = = DialogResult.OK)//If you are sure to open the picture, save the file's path and file name to the string variable filepathname {filepathname = ofd.  FileName; Include path and file name} else if (OFD.        ShowDialog () = = DialogResult.Cancel)//If open, pop-up "Cancel open" window Prompt MessageBox.Show ("Cancel Open");          Establish new system processes System.Diagnostics.Process process = new System.Diagnostics.Process (); Sets the real path and file name of the picture process.          Startinfo.filename = Filepathname;         Sets the process run parameters, where the picture is displayed in the Maximized window method. Process.        startinfo.arguments= "Rundl132.exe C://windows//system32//shimgvw.dll,imageview_fullscreen"; This entry is not available if the shell executes the program, because the system defaults to true, but if the setting must be true process.            Startinfo.useshellexecute = true; Here you can change the display style of the form that the process opens, and you can set no process. StArtinfo.windowstyle = System.Diagnostics.ProcessWindowStyle.Hidden; Process.          Start (); Process.      Close ();   }

  

C # calls the computer's default picture browser software to open the picture

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.