杯具程序员
为系统而生,为框架而死,为debug奋斗一辈子;
     吃符号的亏,上大小写的当,最后死在需求上。
打开窗体的事件:


 	Form3 f = Form3.InstanceObject() ;	//实例化窗体
        f.Focus();   //让窗体获得焦点
        f.Show();    //显示窗体


被打开的窗体:

 public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private static Form3 _instance;

	//创建窗体对象的静态方法
        public static Form3 InstanceObject()
        {
            if (_instance == null)
                _instance = new Form3();
            return _instance;
        }

	//窗体关闭事件
        private void Form3_FormClosing(object sender, FormClosingEventArgs e)
        {
            _instance = null;
        }
    }
posted on 2011-07-11 17:36  杯具程序员  阅读(8988)  评论(0编辑  收藏  举报