Exemplo n.º 1
0
 public UpDownBaseButtonProvider(UpDownBase upDownBase,
                                 UpDownBaseButtonOrientation orientation)
     : base(null)
 {
     this.upDownBase  = upDownBase;
     this.orientation = orientation;
 }
Exemplo n.º 2
0
        public FindMax(int Station = 1)
        {
            InitializeComponent();
            station = Station;
            Path    = AppDomain.CurrentDomain.BaseDirectory + "Setting" + Station.ToString() + "\\";
            if (!Directory.Exists(Path))
            {
                Directory.CreateDirectory(Path);
            }
            if (Station == 1)
            {
                this.Text = "工位一感光片设置";
            }
            else
            {
                this.Text = "工位二感光片设置";
            }


            CircleLine = new LookForCircleLine.mainUtl(Path);
            panelControl1.Controls.Add(CircleLine);
            Size sz = CircleLine.Size;

            panelControl1.Size     = sz;
            CircleLine.Dock        = DockStyle.Fill;
            CircleLine.isFitWindow = false;

            int height = panelControl1.Size.Height;
            int width  = (int)(height * (0.006 / 0.05) * 5);

            CircleLine.splitContainer1.SplitterDistance = width;
            //splitContainerControl1.SplitterPosition = sz.Width;
            roiController = CircleLine.hWindow_Final1.viewWindow._roiController;
            roiController.NotifyRCObserver = new IconicDelegate(ROiMove);
            UpDownBase upDown = (UpDownBase)numericUpDown1;

            upDown.TextChanged += new EventHandler(numericUpDown1_ValueChanged);
            UpDownBase upDown2 = (UpDownBase)numericUpDown2;

            upDown2.TextChanged += new EventHandler(numericUpDown2_ValueChanged);
            UpDownBase upDown3 = (UpDownBase)numericUpDown3;

            upDown3.TextChanged += new EventHandler(numericUpDown3_ValueChanged);
            UpDownBase upDown4 = (UpDownBase)numericUpDown4;

            upDown4.TextChanged += new EventHandler(numericUpDown4_ValueChanged);

            //settingPath = Path + "MaxSetting.xml";
            roiPath = Path + "Roi.roi";
            //if (File.Exists(settingPath))
            //{
            //    inParam = (InputParam)StaticOperate.ReadXML(settingPath, inParam.GetType());

            //}
            inParam = LoadXml(Station);
            ShowToUI();

            CircleLine.load = new LookForCircleLine.mainUtl.LoadImage(LoadImage);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Configure a UpDownBase&lt;T&gt; control.
        /// </summary>
        /// <typeparam name="T">Type parameter.</typeparam>
        /// <param name="udbt">UpDownBase&lt;T&gt; control.</param>
        private void ConfigUDB <T>(UpDownBase <T> udbt)
        {
            Debug.Assert(udbt != null, "udb should not be null!");

            udbt.Value = ParseUtility.ReadValue(tbValue, udbt.Value);
            ////udbt.IsCyclic = (bool)cbIsCyclic.IsChecked;
            udbt.IsEditable = (bool)cbIsEditable.IsChecked;
            udbt.IsEnabled  = (bool)cbIsEnabled.IsChecked;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 离开每几天录入框时的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>判断Text为空时赋1。</remarks>
        private void nm_dayinterval_Leave(object sender, EventArgs e)
        {
            UpDownBase up = (UpDownBase)sender;

            if (up.Text == "")
            {
                ((NumericUpDown)sender).Value = 2;
                ((NumericUpDown)sender).Value = 1;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// UpDownボタンを取得してPrivate変数にセットします。
 /// </summary>
 private void setUpDownButton()
 {
     foreach (Control ctrl in this.Controls)
     {
         if (ctrl is UpDownBase)
         {
             this.upDownButton = (UpDownBase)ctrl;
             return;
         }
     }
 }
Exemplo n.º 6
0
 private void inputControl_SelectAllText(object sender, EventArgs e)
 {
     if (sender is TextBoxBase)
     {
         ((TextBoxBase)sender).SelectAll();
     }
     else if (sender is UpDownBase)
     {
         UpDownBase udb = (UpDownBase)sender;
         udb.Select(0, 2);
     }
 }
Exemplo n.º 7
0
        //private bool Matrix_select = false;
        //private bool Motherboard = false;
        //private bool f_m = false;
        //AutoSizeFormClass asc = new AutoSizeFormClass();
        public WallSetForm(MainForm mainForm)
        {
            settingFile = new IniFiles(Application.StartupPath + "\\setting.ini");
            InitializeComponent();
            //string s = settingFile.ReadString("SETTING", "PicturePath", "");
            this.mainForm = mainForm;
            //button3.Enabled = false;
            //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS");
            //ApplyResource();
            languageFile     = new IniFiles(Application.StartupPath + "\\LanguagePack" + mainForm.package);
            up1              = nud_HDMIAddress as UpDownBase;
            up2              = nud_DVIAddress as UpDownBase;
            up3              = nud_VGAAddress as UpDownBase;
            up4              = nud_VIDEOAddress as UpDownBase;
            up5              = nud_HDMICount as UpDownBase;
            up6              = nud_DVICount as UpDownBase;
            up1.TextChanged += new EventHandler(up1_TextChanged);
            up2.TextChanged += new EventHandler(up2_TextChanged);
            up3.TextChanged += new EventHandler(up3_TextChanged);
            up4.TextChanged += new EventHandler(up4_TextChanged);
            up5.TextChanged += new EventHandler(up5_TextChanged);
            up6.TextChanged += new EventHandler(up6_TextChanged);

            Init_FormString();
            //tb_sceDirectoryName.Text = MainForm.currentConnectionName;

            if (this.mainForm.Chinese_English == 1)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
                ApplyResource();
                //textBox2.MaxLength = 32;
            }
            else if (this.mainForm.Chinese_English == 0)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHS");
                ApplyResource();
                //textBox2.MaxLength = 32;
            }
            else
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CHT");
                ApplyResource();
            }
            initFromFile();
            //tabPage3.Parent = null;//矩阵协议屏蔽
            //tabPage3.Hide();
            //if (!s.Equals(""))
            //pictureBox1.Image = Image.FromFile(@s);
            //textBox1.Text = s;
            Row_Col = false;
            //Matrix_select = false;
        }
Exemplo n.º 8
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            //判断新增的课程是否已存在
            string sqlCourseIsExist = "select COU_NAME from TD_Course where COU_NAME=N'" + CourseNameTB.Text + "'";

            if (CommonFunction.ExecuteSqlReader(sqlCourseIsExist).Count != 0)//如果有数据,那么count!=0,即课程重复了
            {
                MessageBox.Show("该课程已存在!");
                return;
            }
            //NumericUpDown.text不可见,但是其父类UpDownBase.text可见,向上转型取得text
            UpDownBase creditUpDownBase = (UpDownBase)CreditNumericUpDown;

            presenter.CreateCourse(CourseNameTB.Text, creditUpDownBase.Text);
            this.Close();
        }
Exemplo n.º 9
0
        public Blob()
        {
            InitializeComponent();
            UpDownBase upDown = (UpDownBase)numericUpDown1;

            upDown.TextChanged += new EventHandler(Up_textChanged);
            UpDownBase upDown2 = (UpDownBase)numericUpDown2;
            UpDownBase upDown3 = (UpDownBase)numericUpDown3;
            UpDownBase upDown4 = (UpDownBase)numericUpDown4;
            UpDownBase upDown5 = (UpDownBase)numericUpDown5;

            upDown2.TextChanged += new EventHandler(Up_textChanged);
            upDown3.TextChanged += new EventHandler(Up_textChanged);
            upDown4.TextChanged += new EventHandler(Up_textChanged);
            upDown5.TextChanged += new EventHandler(Up_textChanged);
        }
Exemplo n.º 10
0
        public override void InitializeChildControlStructure()
        {
            UpDownBase upDownBase = (UpDownBase)Control;

            if (forwardButton == null)
            {
                forwardButton = new UpDownBaseButtonProvider(upDownBase,
                                                             UpDownBaseButtonOrientation.Forward);
                forwardButton.Initialize();
                AddChildProvider(forwardButton);
            }
            if (backwardButton == null)
            {
                backwardButton = new UpDownBaseButtonProvider(upDownBase,
                                                              UpDownBaseButtonOrientation.Backward);
                backwardButton.Initialize();
                AddChildProvider(backwardButton);
            }
        }
Exemplo n.º 11
0
        protected void OnControlLeave(object sender, EventArgs e)
        {
            Control ctl = sender as Control;

            if (null != ctl)
            {
                this.DeHighlightFont(ctl.Tag as Label);

                if (ctl is IButtonControl)
                {
                    this.DeHighlightFont(ctl);
                }
                else
                {
                    TextBoxBase txt        = ctl as TextBoxBase;
                    UpDownBase  upb        = ctl as UpDownBase;
                    bool        isReadOnly = (null != txt && txt.ReadOnly) || (null != upb && upb.ReadOnly);
                    ctl.BackColor = (isReadOnly ? SystemColors.Window : Color.Empty);
                }
            }
        }
Exemplo n.º 12
0
        private void Num_Price_InPut_Click(object sender, EventArgs e)
        {
            UpDownBase updbText = (UpDownBase)Num_Price_InPut;

            Num_Price_InPut.Select(0, updbText.Text.Length);
        }
Exemplo n.º 13
0
        //****************************************

        internal WinUpDownBase(WinBindingSource source, Control control) : base(source, control)
        {
            _UpDownBase            = (UpDownBase)control;
            _UpDownBase.Validated += OnValidated;
        }
Exemplo n.º 14
0
        /// <summary>
        /// This is used to bind the controls in the given collection to their associated project properties.
        /// </summary>
        /// <param name="controls">The control collection from which to get the bound controls.  Controls are
        /// bound if their <see cref="Control.Tag"/> property is a string that matches a project property.</param>
        /// <remarks>This method is recursive</remarks>
        protected void BindProperties(Control.ControlCollection controls)
        {
            Type         t;
            PropertyInfo pi;
            string       typeName, boundProperty;

            try
            {
                isBinding = true;

                foreach (Control c in controls)
                {
                    t             = c.GetType();
                    typeName      = t.FullName;
                    boundProperty = c.Tag as string;

                    // Ignore unbound controls
                    if (String.IsNullOrEmpty(boundProperty))
                    {
                        // Scan containers too except for user controls unless they are in the custom user control
                        // list.  They may or may not represent a single-valued item and we can't process them
                        // reliably.  The same could be true of one of these if it is a derived type.
                        if (!customControls.ContainsKey(typeName) && (c is GroupBox || c is Panel || c is TabControl ||
                                                                      c is TabPage || c is SplitContainer || customUserControls.Contains(typeName)))
                        {
                            this.BindProperties(c.Controls);
                            continue;
                        }

                        continue;
                    }

                    // Check for custom types first
                    if (customControls.ContainsKey(typeName))
                    {
                        // Find and connect the Changed event for the named property if one exists
                        var changedEvent = t.GetEvents().Where(ev =>
                                                               ev.Name == customControls[typeName] + "Changed").FirstOrDefault();

                        if (changedEvent != null)
                        {
                            EventHandler h = new EventHandler(OnPropertyChanged);
                            changedEvent.RemoveEventHandler(c, h);
                            changedEvent.AddEventHandler(c, h);
                        }

                        pi = t.GetProperty(customControls[typeName], BindingFlags.Public | BindingFlags.Instance);
                    }
                    else if (c is TextBoxBase || c is Label)
                    {
                        c.TextChanged -= OnPropertyChanged;
                        c.TextChanged += OnPropertyChanged;

                        pi = t.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance);
                    }
                    else if (c is ComboBox)
                    {
                        ComboBox cbo = (ComboBox)c;
                        cbo.SelectedIndexChanged -= OnPropertyChanged;
                        cbo.SelectedIndexChanged += OnPropertyChanged;

                        if (cbo.DataSource != null)
                        {
                            pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance);
                        }
                        else
                        {
                            pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance);
                        }
                    }
                    else if (c is CheckBox)
                    {
                        CheckBox cb = (CheckBox)c;
                        cb.CheckedChanged -= OnPropertyChanged;
                        cb.CheckedChanged += OnPropertyChanged;

                        pi = t.GetProperty("Checked", BindingFlags.Public | BindingFlags.Instance);
                    }
                    else if ((c is DateTimePicker) || (c is UpDownBase) || (c is TrackBar))
                    {
                        DateTimePicker dtp = c as DateTimePicker;

                        if (dtp != null)
                        {
                            dtp.ValueChanged -= OnPropertyChanged;
                            dtp.ValueChanged += OnPropertyChanged;
                        }
                        else
                        {
                            UpDownBase udc = c as UpDownBase;

                            if (udc != null)
                            {
                                udc.TextChanged -= OnPropertyChanged;
                                udc.TextChanged += OnPropertyChanged;
                            }
                            else
                            {
                                TrackBar tbar = (TrackBar)c;
                                tbar.ValueChanged -= OnPropertyChanged;
                                tbar.ValueChanged += OnPropertyChanged;
                            }
                        }

                        pi = t.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
                    }
                    else if (c is CheckedListBox)
                    {
                        CheckedListBox clb = (CheckedListBox)c;
                        clb.ItemCheck -= OnPropertyChanged;
                        clb.ItemCheck += OnPropertyChanged;

                        // Since CheckedListBox is a multi-valued control, the user will have to bind it
                        // in the BindControlValue() method override.  They'll have to store it in the
                        // StoreControlValue() method override too.
                        pi = null;
                    }
                    else if (c is ListBox)
                    {
                        ListBox lb = (ListBox)c;
                        lb.SelectedIndexChanged -= OnPropertyChanged;
                        lb.SelectedIndexChanged += OnPropertyChanged;

                        if (lb.DataSource != null)
                        {
                            pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance);
                        }
                        else
                        {
                            pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance);
                        }
                    }
                    else
                    {
                        pi = null;
                    }

                    // Give the user a chance to handle the control in a custom fashion.  If not handled and we
                    // couldn't figure out what to use, ignore it.
                    if (!this.BindControlValue(c) && pi != null)
                    {
                        this.Bind(c, pi, boundProperty);
                    }
                }
            }
            finally
            {
                isBinding = false;
            }
        }
Exemplo n.º 15
0
 public UpDownBaseProvider(UpDownBase upDownBase) : base(upDownBase)
 {
 }
 /// <summary>
 /// Initializes a new instance of the UpDownBaseAutomationPeer class.
 /// </summary>
 /// <param name="owner">
 /// The UpDownBase that is associated with this UpDownBaseAutomationPeer.
 /// </param>
 public UpDownBaseAutomationPeer(UpDownBase <T> owner)
     : base(owner)
 {
 }
Exemplo n.º 17
0
        private void numpreco_Click(object sender, EventArgs e)
        {
            UpDownBase udb = numpreco;

            udb.Select(0, udb.Text.Length);
        }
 public UpDownEditAccessibleObject(UpDownEdit owner, UpDownBase parent) : base(owner)
 {
     _parent = parent.OrThrowIfNull();
 }
Exemplo n.º 19
0
 public static void FixMouseWheel(this UpDownBase updown)
 {
     updown.MouseWheel += UpDown_MouseWheel;
 }