打开窗体的事件:


 	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;
        }
    }
打开窗体的事件:


 	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;
        }
    }

相关文章:

  • 2021-09-07
  • 2021-10-24
  • 2021-06-12
  • 2022-12-23
  • 2022-01-09
  • 2022-01-06
  • 2021-07-02
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
相关资源
相似解决方案