// Constructor takes a reference to the options so that // we can return the results of changes made by the user public Options(ref GUIOptions options) { InitializeComponent(); opt = options; }
public OnOptionSettings(DriveControl form, GUIOptions opt) : base(form) { Options = new GUIOptions(); Options = opt; }
public OnOptionSettings(DriveControl form) : base(form) { Options = new GUIOptions(); }
private void optionsMenuItem_Click(object sender, EventArgs e) { GUIOptions opt = options; Options optDialog = new Options(ref opt); DialogResult result = optDialog.ShowDialog(); if (result == DialogResult.OK) { options = opt; ReformatForm(); } }
// TT - Change the parameters for Form constructor public DriveControl(DriveControlEvents EventsPort, StateType state) { _eventsPort = EventsPort; InitializeComponent(); simulImage.MouseMove += new MouseEventHandler(simulImage_MouseMove); simulImage.MouseDown += new MouseEventHandler(simulImage_MouseDown); _eventsPort.PostUnknownType(new OnSimulLoaded(this, this)); txtPort.ValidatingType = typeof(ushort); // TT - Add initialization code based on the saved State // Restore log file settings txtLogFile.Text = state.LogFile; if (state.Log) { if (state.LogFile != "") { chkLog.Checked = true; // Initialize the log file // Copied code from the Checkbox Click handler txtLogFile.Enabled = !chkLog.Checked; btnBrowse.Enabled = !chkLog.Checked; _eventsPort.PostUnknownType(new OnLogSetting(this, chkLog.Checked, txtLogFile.Text)); } else chkLog.Checked = false; } else chkLog.Checked = false; // Set up the connection parameters txtMachine.Text = state.Machine; if (state.Port != 0) txtPort.Text = state.Port.ToString(); // TT - Version 2 added all the options below options = new GUIOptions(); options = state.Options; this.StartPosition = FormStartPosition.Manual; this.Location = new Point(options.WindowStartX, options.WindowStartY); // The dead zone can't be negative, but it can be zero options.DeadZoneX = Math.Abs(state.Options.DeadZoneX); options.DeadZoneY = Math.Abs(state.Options.DeadZoneY); // Just in case the scale factors have not been initialized if (state.Options.TranslateScaleFactor == 0) options.TranslateScaleFactor = 1.0; else options.TranslateScaleFactor = state.Options.TranslateScaleFactor; if (state.Options.RotateScaleFactor == 0) options.RotateScaleFactor = 0.5; else options.RotateScaleFactor = state.Options.RotateScaleFactor; LRFPanelBaseY = groupBoxLRF.Top; LRFPanelHeight = LRFPanelBaseY; FormBaseHeight = this.Height - LRFPanelHeight; ReformatForm(); }