2014-02-28 14:32:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Windows.Forms.Design;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Controls
|
|
|
|
|
{
|
|
|
|
|
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip)]
|
|
|
|
|
public class ToolStripNumericUpDown : ToolStripControlHost
|
|
|
|
|
{
|
|
|
|
|
public event EventHandler ValueChanged;
|
|
|
|
|
|
|
|
|
|
public decimal Value { get { return nud.Value; } set { nud.Value = value; } }
|
|
|
|
|
public decimal Minimum { get { return nud.Minimum; } set { nud.Minimum = value; } }
|
|
|
|
|
public decimal Maximum { get { return nud.Maximum; } set { nud.Maximum = value; } }
|
2016-10-26 22:33:36 +00:00
|
|
|
|
public decimal Increment { get { return nud.Increment; } set { nud.Increment = value; } }
|
2014-02-28 14:32:20 +00:00
|
|
|
|
|
|
|
|
|
private NumericUpDown nud;
|
|
|
|
|
|
|
|
|
|
public ToolStripNumericUpDown() : base(new NumericUpDown()) { }
|
|
|
|
|
|
|
|
|
|
protected override void OnSubscribeControlEvents(Control control)
|
|
|
|
|
{
|
|
|
|
|
base.OnSubscribeControlEvents(control);
|
|
|
|
|
nud = control as NumericUpDown;
|
|
|
|
|
nud.ValueChanged += OnValueChanged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnUnsubscribeControlEvents(Control control)
|
|
|
|
|
{
|
|
|
|
|
base.OnUnsubscribeControlEvents(control);
|
|
|
|
|
nud.ValueChanged -= OnValueChanged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
if(ValueChanged != null) ValueChanged(this, e);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|