void ctl_SettingsChanged(object sender, EventArgs e) { PwmChannelControl apcc = (PwmChannelControl)sender; changedStates[apcc.ChannelNumber] = true; applyButton.Enabled = true; }
private void AsynchronousPwmControl_Load(object sender, EventArgs e) { int vPos = 2; PwmChannelControl ctl = null; changedStates = new Dictionary <int, bool>(); connector.GeneratorMode = ControlMode; channelControls = new Dictionary <int, PwmChannelControl>(); for (int i = 0; i < 8; i++) { changedStates.Add(i, false); ctl = new PwmChannelControl(); channelControls.Add(i, ctl); ctl.channelSettings = connector.channelSettings[i]; ctl.ChannelNumber = i; ctl.sampleRateHz = (int)connector.SampleRate; ctl.Location = new System.Drawing.Point(2, vPos); ctl.KeyDown += new KeyEventHandler(ctl_KeyDown); ctl.ShowRealValueToolTips = ShowRealValueToolTips; ctl.Connector = connector; ctl.ColoredBorders = ColoredBorders; ctl.BorderColor = GuiStandards.ChannelColors[i]; ctl.EnableFrequencyEdit = (ControlMode == PwmGeneratorModes.Asynchronous); this.Controls.Add(ctl); vPos += ctl.Size.Height + 3; ctl.SettingsChanged += new EventHandler(ctl_SettingsChanged); } applyButton = new Button(); applyButton.Text = "Apply"; applyButton.Click += new EventHandler(applyButton_Click); applyButton.Enabled = false; applyButton.Size = new System.Drawing.Size(60, 29); System.Drawing.Font buttonFont = applyButton.Font; applyButton.Font = new System.Drawing.Font(buttonFont.FontFamily, buttonFont.Size + 0.3F, System.Drawing.FontStyle.Bold); applyButton.Location = new System.Drawing.Point(ctl.Size.Width - applyButton.Size.Width, vPos); this.Controls.Add(applyButton); if (ControlMode == PwmGeneratorModes.Synchronous) { initFrequencyBox(4, vPos + 5); } vPos += applyButton.Size.Height + 3; this.Size = new System.Drawing.Size(ctl.Size.Width + 6, vPos + 2); applyChanges(true); }
private void AsynchronousPwmControl_Load(object sender, EventArgs e) { int vPos = 2; PwmChannelControl ctl = null; changedStates = new Dictionary<int, bool>(); connector.GeneratorMode = ControlMode; channelControls = new Dictionary<int, PwmChannelControl>(); for (int i = 0; i < 8; i++) { changedStates.Add(i, false); ctl = new PwmChannelControl(); channelControls.Add(i, ctl); ctl.channelSettings = connector.channelSettings[i]; ctl.ChannelNumber = i; ctl.sampleRateHz = (int) connector.SampleRate; ctl.Location = new System.Drawing.Point(2, vPos); ctl.KeyDown += new KeyEventHandler(ctl_KeyDown); ctl.ShowRealValueToolTips = ShowRealValueToolTips; ctl.Connector = connector; ctl.ColoredBorders = ColoredBorders; ctl.BorderColor = GuiStandards.ChannelColors[i]; ctl.EnableFrequencyEdit = (ControlMode == PwmGeneratorModes.Asynchronous); this.Controls.Add(ctl); vPos += ctl.Size.Height + 3; ctl.SettingsChanged += new EventHandler(ctl_SettingsChanged); } applyButton = new Button(); applyButton.Text = "Apply"; applyButton.Click += new EventHandler(applyButton_Click); applyButton.Enabled = false; applyButton.Size = new System.Drawing.Size(60, 29); System.Drawing.Font buttonFont = applyButton.Font; applyButton.Font = new System.Drawing.Font(buttonFont.FontFamily, buttonFont.Size + 0.3F, System.Drawing.FontStyle.Bold); applyButton.Location = new System.Drawing.Point(ctl.Size.Width - applyButton.Size.Width, vPos); this.Controls.Add(applyButton); if (ControlMode == PwmGeneratorModes.Synchronous) { initFrequencyBox(4, vPos + 5); } vPos += applyButton.Size.Height + 3; this.Size = new System.Drawing.Size(ctl.Size.Width + 6, vPos + 2); applyChanges(true); }