private void CreateControlLayout() { Headlabel.Text = $"Value"; numericUpDown = new NumUpDown(); numericUpDown.Location = Headlabel.Underneath().AddY(2).AddX(4); numericUpDown.Width = this.Width / 2; numericUpDown.Maximum = ushort.MaxValue; numericUpDown.BorderStyle = BorderStyle.None; numericUpDown.ValueChanged += (_, __) => { }; this.Height = numericUpDown.Bottom; var pos = new Point() { X = this.ClientRectangle.Width - 16, Y = Headlabel.Bottom }; Output = new ConnectionPoint(typeof(ushort)); Output.Location = pos; Output.OnConnectionStateChange += (_, e) => { base.RaiseFeebackEvent(new FeebackEventArgs(e)); }; Output.SetColor(COLORVALUE); this.Height = Output.Bottom; this.Controls.Add(numericUpDown); this.Controls.Add(Output); }
public IntegerInput(int initialValue, int inputMax) { InitializeComponent(); fallbackValue = initialValue; ClosingOk = false; NumUpDown.Maximum = inputMax; NumUpDown.Value = initialValue; NumUpDown.Select(0, NumUpDown.Value.ToString().Length); }
private void NumUpDown_Focus(object sender, EventArgs e) { NumUpDown.Select(0, NumUpDown.Text.Length); }