Mesen-X/GUI.NET/Controls/MesenNumericUpDown.cs

99 lines
2.5 KiB
C#
Raw Normal View History

2017-09-16 22:02:05 -04:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
2017-09-16 22:02:05 -04:00
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
class MesenNumericUpDown : BaseControl
{
private NumericUpDown nud;
public event EventHandler ValueChanged { add { nud.ValueChanged += value; } remove { nud.ValueChanged -= value; } }
public new event EventHandler Validated { add { nud.Validated += value; } remove { nud.Validated -= value; } }
public new event EventHandler Click { add { nud.Click += value; } remove { nud.Click -= value; } }
public new event KeyEventHandler KeyDown { add { nud.KeyDown += value; } remove { nud.KeyDown -= value; } }
public new event KeyPressEventHandler KeyPress { add { nud.KeyPress += value; } remove { nud.KeyPress -= value; } }
2017-09-16 22:02:05 -04:00
[Browsable(true)]
[EditorBrowsable(EditorBrowsableState.Always)]
public new event EventHandler TextChanged { add { nud.TextChanged += value; } remove { nud.TextChanged -= value; } }
2017-09-16 22:02:05 -04:00
public decimal Value
{
get { return nud.Value; }
set
{
nud.Text = value.ToString();
nud.Value = value;
}
}
public new string Text
{
get { return nud.Text; }
set { nud.Text = value; }
}
public decimal Maximum
{
get { return nud.Maximum; }
set { nud.Maximum = value; }
}
public decimal Minimum
{
get { return nud.Minimum; }
set { nud.Minimum = value; }
}
public decimal Increment
{
get { return nud.Increment; }
set { nud.Increment = value; }
}
public int DecimalPlaces
{
get { return nud.DecimalPlaces; }
set { nud.DecimalPlaces = value; }
}
public MesenNumericUpDown()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.nud = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.nud)).BeginInit();
this.SuspendLayout();
//
// nud
//
this.nud.AutoSize = true;
this.nud.Dock = System.Windows.Forms.DockStyle.Fill;
this.nud.Location = new System.Drawing.Point(0, 0);
this.nud.Name = "nud";
this.nud.Size = new System.Drawing.Size(48, 20);
this.nud.TabIndex = 0;
//
// MesenNumericUpDown
//
this.Controls.Add(this.nud);
2017-09-17 00:54:30 -04:00
this.MaximumSize = new Size(10000, 20);
2017-09-16 22:02:05 -04:00
this.Name = "MesenNumericUpDown";
this.Size = new System.Drawing.Size(48, 21);
((System.ComponentModel.ISupportInitialize)(this.nud)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
}
}