|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace JwKdsV.Component
|
|
|
|
|
{
|
|
|
|
|
public partial class NumSpinnersV : UserControl
|
|
|
|
|
{
|
|
|
|
|
public NumSpinnersV()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnLoad(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private decimal _defaultValue = 0;
|
|
|
|
|
[Category("杂项"), Description("默认值"), DefaultValue(0)]
|
|
|
|
|
public decimal DefaultValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _defaultValue;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_defaultValue = value;
|
|
|
|
|
this.label1.Text = _defaultValue + "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Category("杂项"), Description("步长,每次增减标准"), DefaultValue(1)]
|
|
|
|
|
public decimal StepValue { get; set; }
|
|
|
|
|
|
|
|
|
|
[Category("杂项"), Description("最大值"), DefaultValue(100)]
|
|
|
|
|
public decimal MaxValue { get; set; }
|
|
|
|
|
|
|
|
|
|
[Category("杂项"), Description("最小值"), DefaultValue(0)]
|
|
|
|
|
public decimal MinValue { get; set; }
|
|
|
|
|
|
|
|
|
|
[Category("杂项"), Description("是否循环"), DefaultValue(true)]
|
|
|
|
|
public bool Circle { get; set; }
|
|
|
|
|
|
|
|
|
|
public decimal NumValue
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var test = this.label1.Text;
|
|
|
|
|
decimal value = 0;
|
|
|
|
|
decimal.TryParse(test, out value);
|
|
|
|
|
this.label1.Text = value + "";
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
this.label1.Text = value + "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void OnPlusClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (this.NumValue + this.StepValue <= this.MaxValue)
|
|
|
|
|
{
|
|
|
|
|
this.label1.Text = (this.NumValue + this.StepValue).ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.label1.Text = this.MinValue.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 减
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void OnMinusClick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.NumValue - this.StepValue >= this.MinValue)
|
|
|
|
|
{
|
|
|
|
|
this.label1.Text = (this.NumValue - this.StepValue).ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.label1.Text = this.MaxValue.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnTextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
OnNumChanged?.Invoke(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public delegate void EventHandler(object sender, EventArgs e);
|
|
|
|
|
|
|
|
|
|
public event EventHandler OnNumChanged;
|
|
|
|
|
}
|
|
|
|
|
}
|