* 控件中用到的Timer在控件销毁时释放

This commit is contained in:
Sunny 2020-11-21 11:46:59 +08:00
parent 325a384b4f
commit 359586ab7a
12 changed files with 51 additions and 5 deletions

Binary file not shown.

View File

@ -51,8 +51,9 @@ namespace Sunny.UI
public UIDatetimePicker()
{
InitializeComponent();
Width = 200;
Value = DateTime.Now;
Text = Value.ToString(DateFormat);
Width = 200;
EditorLostFocus += UIDatePicker_LostFocus;
TextChanged += UIDatePicker_TextChanged;
MaxLength = 19;

View File

@ -47,6 +47,12 @@ namespace Sunny.UI
fillPressColor = Color.FromArgb(74, 131, 229);
}
~UIHorScrollBar()
{
timer.Stop();
timer.Dispose();
}
private int scrollValue;
private int SmallChange = 1;
private int LargeChange = 10;

View File

@ -44,6 +44,12 @@ namespace Sunny.UI
private readonly Color[] _surroundColor = new Color[] { Color.FromArgb(0, 255, 255, 255) };
private readonly Timer _timer = new Timer();
~UILedBulb()
{
_timer.Stop();
_timer.Dispose();
}
/// <summary>
/// Gets or Sets the color of the LED light
/// </summary>

View File

@ -47,6 +47,12 @@ namespace Sunny.UI
timer.Tick += Timer_Tick;
}
~UILedStopwatch()
{
timer.Stop();
timer.Dispose();
}
public enum TimeShowType
{
mmss,

View File

@ -97,6 +97,7 @@ namespace Sunny.UI
~UIListBox()
{
timer.Stop();
timer.Dispose();
}
private void Timer_Tick(object sender, EventArgs e)

View File

@ -50,6 +50,7 @@ namespace Sunny.UI
~UIProgressIndicator()
{
timer.Stop();
timer.Dispose();
}
public override void SetStyleColor(UIBaseStyle uiColor)

View File

@ -64,6 +64,12 @@ namespace Sunny.UI
public event EventHandler ValueChanged;
~UIScrollBar()
{
timer.Stop();
timer.Dispose();
}
[DefaultValue(0)]
[Description("当前值"), Category("SunnyUI")]
public int Value

View File

@ -56,6 +56,7 @@ namespace Sunny.UI
~UIScrollingText()
{
timer.Stop();
timer.Dispose();
}
[DefaultValue(200), Description("刷新间隔"), Category("SunnyUI")]

View File

@ -53,6 +53,12 @@ namespace Sunny.UI
timer.Tick += Timer_Tick;
}
~UITabControl()
{
timer.Stop();
timer.Dispose();
}
private void Timer_Tick(object sender, EventArgs e)
{
timer.Stop();

View File

@ -46,6 +46,12 @@ namespace Sunny.UI
timer.Start();
}
~UIWaitingBar()
{
timer.Stop();
timer.Dispose();
}
private void UIWaitingBar_PaintOther(object sender, PaintEventArgs e)
{
e.Graphics.FillRoundRectangle(rectColor, (int)dz + 1, 1, sliderWidth, Height - 3, Radius);

View File

@ -58,6 +58,12 @@ namespace Sunny.UI
timer.Start();
}
~Thunder()
{
timer.Stop();
timer.Dispose();
}
private void Timer_Tick(object sender, EventArgs e)
{
timer.Stop();