private void trackBar_Scroll(object sender, EventArgs e)
        {
            int    value = trackBar.Value;
            double min   = analogOutput.LimitMin;
            double max   = analogOutput.LimitMax;

            double outputValue = (1.0 * value / trackBar.Maximum) * (max - min) + min;

            analogOutput.Set(outputValue);
        }
예제 #2
0
        private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            ListViewItem item = listView1.SelectedItems[0];

            if (item.Tag is IAnalogOutput)
            {
                IAnalogOutput analogOut = (IAnalogOutput)item.Tag;
                if (e.Label != null)
                {
                    double newValue = Convert.ToDouble(e.Label);
                    analogOut.Set(newValue);
                }
            }
        }