예제 #1
0
 private void valueControl3_ValueChanged(object o, ValueControl.ValueChangedEventArgs e)
 {
     if (this.m_lock.WaitOne(0))
     {
         RoataeConfig config = tabPage_Roatae.Tag as RoataeConfig;
         if (config != null)
         {
             config.Value = e.Value;
         }
         foreach (ListViewItem item in listView1.Items)
         {
             if (item.Tag == config)
             {
                 item.SubItems[2].Text = config.Value.ToString();
             }
         }
         Run();
         this.m_lock.Release();
     }
 }
예제 #2
0
 private void valueControl4_ValueChanged(object o, ValueControl.ValueChangedEventArgs e)
 {
     if (this.m_lock.WaitOne(0))
     {
         GainOffsetConfig config = tabPage_GainOffset.Tag as GainOffsetConfig;
         if (config != null)
         {
             config.Offset = e.Value;
         }
         foreach (ListViewItem item in listView1.Items)
         {
             if (item.Tag == config)
             {
                 item.SubItems[2].Text = config.Gain + "," + config.Offset;
             }
         }
         Run();
         this.m_lock.Release();
     }
 }
예제 #3
0
        private void valueControl1_ValueChanged(object o, ValueControl.ValueChangedEventArgs e)
        {
            if (this.m_lock.WaitOne(0))
            {
                ThresholdConfig config = tabPage_Threshold.Tag as ThresholdConfig;
                if (config != null)
                {
                    if (config.Mode == ThresholdConfig.MyThresholdMode.Absolute)
                    {
                        config.AbsoluteValue = e.Value;
                    }
                    else if (config.Mode == ThresholdConfig.MyThresholdMode.Relative)
                    {
                        config.RelativeValue = (float)e.Value / 100f;
                    }

                    foreach (ListViewItem item in listView1.Items)
                    {
                        if (item.Tag == config)
                        {
                            if (config.Mode == ThresholdConfig.MyThresholdMode.Absolute)
                            {
                                item.SubItems[2].Text = config.AbsoluteValue.ToString();
                            }
                            else if (config.Mode == ThresholdConfig.MyThresholdMode.Relative)
                            {
                                item.SubItems[2].Text = config.RelativeValue.ToString();
                            }
                        }
                    }
                    Run();
                }

                this.m_lock.Release();
            }
        }
예제 #4
0
        private void valueControl2_ValueChanged(object o, ValueControl.ValueChangedEventArgs e)
        {
            if (this.m_lock.WaitOne(0))
            {
                ValueControl vlctrl = o as ValueControl;
                object       config = tabPage_Morphology.Tag;
                switch (vlctrl.ValueName)
                {
                case "宽度":

                    if (config is DilateConfig)
                    {
                        DilateConfig dc = config as DilateConfig;
                        if (dc != null)
                        {
                            dc.Width = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = dc.Width.ToString() + "," + dc.Height.ToString();
                            }
                        }
                    }
                    else if (config is ErodeConfig)
                    {
                        ErodeConfig ec = config as ErodeConfig;
                        if (ec != null)
                        {
                            ec.Width = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = ec.Width.ToString() + "," + ec.Height.ToString();
                            }
                        }
                    }
                    else if (config is OpenConfig)
                    {
                        OpenConfig oc = config as OpenConfig;
                        if (oc != null)
                        {
                            oc.Width = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = oc.Width.ToString() + "," + oc.Height.ToString();
                            }
                        }
                    }
                    else if (config is CloseConfig)
                    {
                        CloseConfig cc = config as CloseConfig;
                        if (cc != null)
                        {
                            cc.Width = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = cc.Width.ToString() + "," + cc.Height.ToString();
                            }
                        }
                    }
                    break;

                case "高度":

                    if (config is DilateConfig)
                    {
                        DilateConfig dc = config as DilateConfig;
                        if (dc != null)
                        {
                            dc.Height = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = dc.Width.ToString() + "," + dc.Height.ToString();
                            }
                        }
                    }
                    else if (config is ErodeConfig)
                    {
                        ErodeConfig ec = config as ErodeConfig;
                        if (ec != null)
                        {
                            ec.Height = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = ec.Width.ToString() + "," + ec.Height.ToString();
                            }
                        }
                    }
                    else if (config is OpenConfig)
                    {
                        OpenConfig oc = config as OpenConfig;
                        if (oc != null)
                        {
                            oc.Height = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = oc.Width.ToString() + "," + oc.Height.ToString();
                            }
                        }
                    }
                    else if (config is CloseConfig)
                    {
                        CloseConfig cc = config as CloseConfig;
                        if (cc != null)
                        {
                            cc.Height = e.Value;
                        }
                        foreach (ListViewItem item in listView1.Items)
                        {
                            if (item.Tag == config)
                            {
                                item.SubItems[2].Text = cc.Width.ToString() + "," + cc.Height.ToString();
                            }
                        }
                    }
                    break;

                default:
                    break;
                }

                Run();
                this.m_lock.Release();
            }
        }