public ATMLForm() { InitializeComponent(); FormManager.AddActiveForm(this); //TODO: Need to rethink this for nested dialogs (Specification Groups for example) /* * if (!FormManager.AddActiveForm(this)) * { * MessageBox.Show(@"An instance of this form type is already open."); * DialogResult = DialogResult.Abort; * Close(); * } */ BackColor = ATMLContext.COLOR_FORM; panel1.BackColor = ATMLContext.COLOR_PANEL; StartPosition = FormStartPosition.CenterScreen; btnCancel.CausesValidation = false; btnOk.CausesValidation = true; Closing += ATMLForm_Closing; Activated += ATMLForm_Activated; HandleDestroyed += ATMLForm_HandleDestroyed; AddValidatingHandlers(Controls); Resize += (sender, args) => SyncFormLocations(); Move += (sender, args) => SyncFormLocations(); Graphics g = CreateGraphics(); try { _currentDpi = g.DpiX; } finally { g.Dispose(); } }