Example #1
0
        private void axisControl1_ActualDoubleClick(object sender, EventArgs e)
        {
            if (this.btnStart.Enabled)
            {
                AxisItem control = sender as AxisItem;
                Binding binding = control.DataBindings[1];
                var member = binding.BindingMemberInfo.BindingMember;
                Type type = this.CurrInfo.GetType();
                System.Reflection.PropertyInfo info = type.GetProperty(member);
                decimal value = Convert.ToDecimal(info.GetValue(this.CurrInfo, null));
                FormSetValue form = new FormSetValue(value);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    var tempMember = "TempLogPos" + member.Replace("ActPos", "");

                    System.Reflection.PropertyInfo tempPosInfo = type.GetProperty(tempMember);

                    decimal oldValue = Convert.ToDecimal(tempPosInfo.GetValue(this.CurrInfo, null));

                    tempPosInfo.SetValue(this.CurrInfo, oldValue - value + form.SetInfo.Value, null);
                }
            }
        }
Example #2
0
        private void gaugeg_DoubleClick(object sender, MouseEventArgs e)
        {
            if (this.btnStart.Enabled)
            {
                GaugeControl control = sender as GaugeControl;

                foreach (var item in control.Gauges)
                {
                    if (item.Bounds.Contains(e.Location))
                    {
                        DigitalGauge gauge = item as DigitalGauge;
                        Binding binding = gauge.DataBindings[0];
                        var member = binding.BindingMemberInfo.BindingMember;
                        if (member.StartsWith("ActPos"))
                        {
                            Type type = this.CurrInfo.GetType();
                            System.Reflection.PropertyInfo info = type.GetProperty(member);
                            decimal value = Convert.ToDecimal(info.GetValue(this.CurrInfo, null));
                            FormSetValue form = new FormSetValue(value);
                            if (form.ShowDialog() == DialogResult.OK)
                            {
                                var tempMember = "TempLogPos" + member.Replace("ActPos", "");

                                System.Reflection.PropertyInfo tempPosInfo = type.GetProperty(tempMember);

                                decimal oldValue = Convert.ToDecimal(tempPosInfo.GetValue(this.CurrInfo, null));

                                tempPosInfo.SetValue(this.CurrInfo, oldValue - value + form.SetInfo.Value, null);
                            }
                        }
                        break;
                    }
                }
            }
        }