using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public static void ShowUI()
        {
            if (singleton == null || singleton.IsDisposed)
            {
                singleton = new Form1();
            }
            else
            {
                if (singleton.WindowState == FormWindowState.Minimized)
                {
                    singleton.WindowState = FormWindowState.Normal;
                }
                singleton.Activate();
            }
            if (!singleton.Visible)
            {
                singleton.Show();
            }
        }
        private static Form1 singleton;
        private Form1()
        {
            InitializeComponent();
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-01-25
  • 2022-12-23
  • 2021-09-18
  • 2021-10-24
  • 2022-12-23
相关资源
相似解决方案