C# 以最大化启动记事本

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//添加名空间
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);
            }
        }
        //最小化启动记事本
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                ProcessStartInfo MyStarInfo = new ProcessStartInfo();
                MyStarInfo.FileName = "Notepad.exe";
                ////窗口起始状态最小化
                MyStarInfo.WindowStyle = ProcessWindowStyle.Minimized;
                Process MyProcees = new Process();
                MyProcees.StartInfo = MyStarInfo;
                MyProcees.Start();

 

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "信息提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        //正常启动记事本
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                ProcessStartInfo MyStarInfo = new ProcessStartInfo();
                MyStarInfo.FileName = "Notepad.exe";
              
                Process MyProcees = new Process();
                MyProcees.StartInfo = MyStarInfo;
                MyProcees.Start();

 

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "信息提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/jingang123gz/archive/2007/10/27/1847070.aspx

posted @ 2009-08-17 21:32  oraclejava  阅读(517)  评论(0)    收藏  举报