private void frmMain_Load(object sender, EventArgs e) { Text = Program.AppTitle; toolTipSound.SetToolTip(btnSound, "Sound on/off"); lblTimer.Visible = false; lblTimerTotal.Visible = false; _isMinimized = false; Game.DrawBoard(6); Utils.CenterForm(this); // System menu try { _mSystemMenu = SystemMenu.FromForm(this); _mSystemMenu.AppendSeparator(); _mSystemMenu.AppendMenu(MHallFameId, "Hall of Fame"); _mSystemMenu.AppendMenu(MAboutId, "About"); // debuging! if (Debug) { _mSystemMenu.AppendMenu(MDebugId, "Debug"); } } catch (NoSystemMenuException ex) { Console.WriteLine(ex.ToString()); } }
// Retrieves a new object from a Form object public static SystemMenu FromForm(Form frm) { var cSysMenu = new SystemMenu(); cSysMenu._mSysMenu = apiGetSystemMenu(frm.Handle, 0); if (cSysMenu._mSysMenu == IntPtr.Zero) { // Throw an exception on failure throw new NoSystemMenuException(); } return(cSysMenu); }