コード例 #1
0
 private void Year_Leave(object sender, EventArgs e)
 {
     if (!ValdateYear())
     {
         //MessageBoxes.CustomMessageForm.CustomMessageBox.Show("خطا", ResourceManager.GetResourceManager().GetString("InvalidDate"), "e");
         Year.Focus();
     }
 }
コード例 #2
0
 private void Day_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && Day.Focused)
     {
         Month.Focus();
         Month.Focus();
         Month.Select(0, 3);
     }
     else
     {
         CheckKeyUpDown(e, Day, 31);
     }
 }
コード例 #3
0
 void Day_Leave(object sender, EventArgs e)
 {
     if (Day.Text.Length == 1)
     {
         Day.Text = String.Concat("0", Day.Text);
     }
     if (Day.Text.Length == 0)
     {
         Day.Text = TodayFullChar().Substring(8, 2);
     }
     if (!ValidateDay())
     {
         //MessageBoxes.CustomMessageForm.CustomMessageBox.Show("خطا", ResourceManager.GetResourceManager().GetString("InvalidDate"), "e");
         Day.Focus();
     }
 }
コード例 #4
0
        /// <summary>
        /// Constructor with initial and bounding values</summary>
        /// <param name="value">Initial value</param>
        /// <param name="min">Minimum value</param>
        /// <param name="max">Maximum value</param>
        public FloatInputControl(float value, float min, float max)
        {
            if (min >= max)
                throw new ArgumentException("min must be less than max");
            DoubleBuffered = true;
            m_min = min;
            m_max = max;
            m_value = MathUtil.Clamp(value, m_min, m_max);
            m_lastChange = m_value;
            m_lastEdit = m_value;
            
            m_textBox = new NumericTextBox();
            m_textBox.BorderStyle = BorderStyle.None;
            m_textBox.Name = "m_textBox";

            m_spinner = new CompactSpinner();
            m_spinner.GotFocus += (sender, e) => m_textBox.Focus();
            
            SuspendLayout();            
            UpdateTextBox();            
            Controls.Add(m_textBox);            
            Controls.Add(m_spinner);            
            ResumeLayout(false);
            PerformLayout();

            m_textBox.ValueEdited += (sender, e) =>
            {
                float val = (float)m_textBox.Value;
                SetValue(val, false);
                EndEdit(true);
            };

            m_spinner.Changed += (sender, e) =>
            {
                // might be better to expose delta as property
                float delta = (m_max - m_min) / 100.0f;
                float newValue = Value + (float)e.Value * delta;
                SetValue(newValue, false);
            };

            m_textBox.SizeChanged += (sender, e) => Height = m_textBox.Height + 3;
            SizeChanged += (sender, e) =>
            {
                m_spinner.Bounds = new Rectangle(0, 0, Height, Height);
                m_textBox.Bounds = new Rectangle(m_spinner.Width, 0, Width - m_spinner.Width, m_textBox.Height);
            };
        }
コード例 #5
0
        /// <summary>
        /// Constructor with initial and bounding values</summary>
        /// <param name="value">Initial value</param>
        /// <param name="min">Minimum value</param>
        /// <param name="max">Maximum value</param>
        public IntInputControl(int value, int min, int max)
        {
            if (min >= max)
                throw new ArgumentException("min must be less than max");
            DoubleBuffered = true;
            m_min = min;
            m_max = max;
            m_value = MathUtil.Clamp(value, m_min, m_max);
            m_lastChange = m_value;
            m_lastEdit = m_value;
            
            m_textBox = new NumericTextBox(typeof(int));
            m_textBox.BorderStyle = BorderStyle.None;
            m_textBox.Name = "m_textBox";

            m_spinner = new CompactSpinner();
            m_spinner.GotFocus += (sender, e) => m_textBox.Focus();

            SuspendLayout();            
            UpdateTextBox();                        
            Controls.Add(m_textBox);            
            Controls.Add(m_spinner);                        
            ResumeLayout(false);
            PerformLayout();
            
            m_textBox.ValueEdited += (sender, e) =>
                {
                    int val = (int)m_textBox.Value;
                    SetValue(val, false);
                    EndEdit(true);
                };

            m_spinner.Changed += (sender, e) =>
                {                   
                    int newValue = Value + e.Value;
                    SetValue(newValue, false);
                };

            m_textBox.SizeChanged += (sender, e) => this.Height = m_textBox.Height + 3;                
            SizeChanged += (sender, e) =>
                {
                    m_spinner.Bounds = new Rectangle(0, 0, Height, Height);
                    m_textBox.Bounds = new Rectangle(m_spinner.Width, 0, Width - m_spinner.Width, m_textBox.Height);
                };
        }
コード例 #6
0
ファイル: ArrayEditingControl.cs プロジェクト: zoombapup/ATF
            public ItemControl(int index, object item, int indexColumnWidth)
            {
                m_index = index;

                m_editControl = new NumericTextBox(item.GetType())
                {
                    Dock        = DockStyle.Fill,
                    BorderStyle = System.Windows.Forms.BorderStyle.None
                };

                m_editControl.Width = Width - indexColumnWidth;


                m_editControl.Value        = item;
                m_editControl.Invalidated += editControl_Invalidated;
                m_editControl.ValueEdited += m_editControl_ValueChanged;

                m_selectButton = new Label
                {
                    Width     = indexColumnWidth,
                    Dock      = DockStyle.Left,
                    Text      = Index.ToString(),
                    TextAlign = ContentAlignment.MiddleCenter,
                    BackColor = UnselectedColor,
                    FlatStyle = FlatStyle.Flat,
                    Font      = s_regularFont
                };

                m_selectButton.MouseDown += selectButton_MouseDown;

                Height = m_editControl.Height;

                Controls.Add(m_editControl);
                Controls.Add(m_selectButton);

                m_editControl.SizeChanged += (sender, e) =>
                {
                    Height = m_editControl.Height;
                };

                GotFocus += (sender, e) => m_editControl.Focus();
                m_editControl.GotFocus += (sender, e) => UpdateSelection();
            }
コード例 #7
0
    public void OnSubmit(object sender, EventArgs e)
    {
        try
        {
            int s = Int32.Parse(inputBox.Text);
            if (s < 0 || s > 999)
            {
                inputBox.Focus();
                return;
            }
            inputBox.Text = "";
            tracker.Submit(s);

            if (tracker.IsRunning())
            {
                SwapControls(submit);
            }

            display.UpdateScores();

            if (tracker.IsFinished())
            {
                SwapControls(save);
                save.Focus();
                return;
            }
            else
            {
                inputBox.Focus();
            }
        }
        catch (Exception)
        {
            inputBox.Text = "";
            inputBox.Focus();
        }
    }
コード例 #8
0
        private void buttonNew_Click(object sender, EventArgs e)
        {
            if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolCreateContainer", true))
            {
                return;
            }

            buttonClicked = buttonNew.Text; // "new";
            //textBoxStageID;
            //textBoxUserName;
            //dateTimePicker1;

            EnableControls(true);

            comboBoxContainers.SelectedValue = -1;
            comboBoxProducts.SelectedValue   = -1;

            EnableButtons("new");

            ClearForm();

            textBoxTagNumber.Focus();
            controlWithFocus = textBoxTagNumber;

            //comboBoxProducts.Focus();
            //controlWithFocus = comboBoxProducts;

            //for upon exit
            flagChange = true;

            if (sol_Agency != null &&
                sol_Agency.AutoGenerateTagNumber
                )
            {
                //add row
                if (AddStagedRow())
                {
                    //textBoxTagNumber.Text = sol_Stage.TagNumber;
                    textBoxTagNumber.ReadOnly = true;
                    comboBoxProducts.Focus();
                }
                else
                {
                    buttonCancel.PerformClick();
                }
            }
        }
コード例 #9
0
 public void HilightControl()
 {
     m_control.Focus();
     m_control.SelectAll();
 }