コード例 #1
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            try
            {
                if (shown_done == false)
                {
                    //In Form_Load it seems to work not always (without DWM)
                    if (Program.IsProtected)
                    {
                        WndProtect.Protect(this.Handle);
                        timerProtection.Enabled = true;
                    }

                    if (toggleAfterShow)
                    {
                        ToggleFullscreen();
                    }

                    //ugly trick to make sure our window is in foreground!
                    this.TopMost = true;
                    this.BringToFront();
                    this.TopMost = false;
                    shown_done   = true;
                }
            }
            catch (System.Exception ex)
            {
                LogFile.Warn("Exception in FormMain_Shown(): " + ex.ToString());
            }
        }