public MainForm() { InitializeComponent(); this.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); #if Analyzer btnAnalyzerPng.Enabled = true; btnAnalyzerPng.Visible = true; #else btnAnalyzerPng.Visible = false; btnAnalyzerPng.Enabled = false; btnAnalyzerPng.BackgroundImage.Dispose(); // Resize Comm panel to fit the whole height of the window. pnlComm.Size = new Size(pnlComm.Size.Width, pnlComm.Size.Height + (pnlComm.Location.Y - btnAnalyzerPng.Location.Y)); pnlComm.Location = btnAnalyzerPng.Location; flowCommStatus.Size = new Size(flowCommStatus.Width, pnlComm.Size.Height); #endif prgmInit(); // start the CommPort selector form. serialportForm = new SerialportForm(); serialportForm.FormClosing += new FormClosingEventHandler(serialportForm_FormClosing); serialportForm.Show(); serialportForm.TopMost = true; }
/// <summary> /// Open a new port selection window to change ports. /// </summary> private void btnChangePort_Click(object sender, EventArgs e) { SerialportForm serialportForm = new SerialportForm(); serialportForm.FormClosing += new FormClosingEventHandler(serialportChange_FormClosing); serialportForm.Show(); serialportForm.TopMost = true; }