//添加命名空間

using System.Diagnostics;

namespace //以最大化啟動記事本

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

       

//啟動記事本

        private void button1_Click(object sender, EventArgs e)

        {

            try

            {

                ProcessStartInfo MyStarInfo = new ProcessStartInfo();

                MyStarInfo.FileName="Notepad.exe";

 

                //視窗起始狀態最大化

                MyStarInfo.WindowStyle = ProcessWindowStyle.Maximized;

                Process MyProcees = new Process();

                MyProcees.StartInfo = MyStarInfo;

                MyProcees.Start();

            }

            catch (Exception ex) //避免產生錯誤而造成當機

            {              

                MessageBox.Show(ex.Message, "資訊提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }

        }

Barry 發表在 痞客邦 PIXNET 留言(2) 人氣()


留言列表 (2)

發表留言
  • olivermode
  • 謝謝!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!ㄅ
  • olivermode
  • (抱歉是多打的)謝謝!