diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index f5a068f8..f3efb68b 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIDateTimePicker.cs b/SunnyUI/Controls/UIDateTimePicker.cs index a0c13089..1867142b 100644 --- a/SunnyUI/Controls/UIDateTimePicker.cs +++ b/SunnyUI/Controls/UIDateTimePicker.cs @@ -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; diff --git a/SunnyUI/Controls/UIHorScrollBar.cs b/SunnyUI/Controls/UIHorScrollBar.cs index 654d5920..e996e842 100644 --- a/SunnyUI/Controls/UIHorScrollBar.cs +++ b/SunnyUI/Controls/UIHorScrollBar.cs @@ -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; diff --git a/SunnyUI/Controls/UILedBulb.cs b/SunnyUI/Controls/UILedBulb.cs index 99e241d7..1ee045ce 100644 --- a/SunnyUI/Controls/UILedBulb.cs +++ b/SunnyUI/Controls/UILedBulb.cs @@ -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(); + } + /// /// Gets or Sets the color of the LED light /// @@ -129,7 +135,7 @@ namespace Sunny.UI /// private void drawControl(Graphics g, bool on) { - // Is the bulb on or off + // Is the bulb on or off Color lightColor = (on) ? Color : Color.FromArgb(150, DarkColor); Color darkColor = (on) ? DarkColor : DarkDarkColor; @@ -143,7 +149,7 @@ namespace Sunny.UI // Draw the background ellipse var rectangle = new Rectangle(Padding.Left, Padding.Top, diameter, diameter); - g.FillEllipse(darkColor, rectangle,true); + g.FillEllipse(darkColor, rectangle, true); // Draw the glow gradient var path = new GraphicsPath(); diff --git a/SunnyUI/Controls/UILedStopwatch.cs b/SunnyUI/Controls/UILedStopwatch.cs index 7496cc17..0d27b991 100644 --- a/SunnyUI/Controls/UILedStopwatch.cs +++ b/SunnyUI/Controls/UILedStopwatch.cs @@ -47,6 +47,12 @@ namespace Sunny.UI timer.Tick += Timer_Tick; } + ~UILedStopwatch() + { + timer.Stop(); + timer.Dispose(); + } + public enum TimeShowType { mmss, diff --git a/SunnyUI/Controls/UIListBox.cs b/SunnyUI/Controls/UIListBox.cs index d6c34942..1acd5bce 100644 --- a/SunnyUI/Controls/UIListBox.cs +++ b/SunnyUI/Controls/UIListBox.cs @@ -97,6 +97,7 @@ namespace Sunny.UI ~UIListBox() { timer.Stop(); + timer.Dispose(); } private void Timer_Tick(object sender, EventArgs e) diff --git a/SunnyUI/Controls/UIProgressIndicator.cs b/SunnyUI/Controls/UIProgressIndicator.cs index 9a7d2311..9583f48e 100644 --- a/SunnyUI/Controls/UIProgressIndicator.cs +++ b/SunnyUI/Controls/UIProgressIndicator.cs @@ -50,6 +50,7 @@ namespace Sunny.UI ~UIProgressIndicator() { timer.Stop(); + timer.Dispose(); } public override void SetStyleColor(UIBaseStyle uiColor) diff --git a/SunnyUI/Controls/UIScrollBar.cs b/SunnyUI/Controls/UIScrollBar.cs index db4fbc12..5af45040 100644 --- a/SunnyUI/Controls/UIScrollBar.cs +++ b/SunnyUI/Controls/UIScrollBar.cs @@ -64,6 +64,12 @@ namespace Sunny.UI public event EventHandler ValueChanged; + ~UIScrollBar() + { + timer.Stop(); + timer.Dispose(); + } + [DefaultValue(0)] [Description("当前值"), Category("SunnyUI")] public int Value diff --git a/SunnyUI/Controls/UIScrollingText.cs b/SunnyUI/Controls/UIScrollingText.cs index c6980c6e..24fccae5 100644 --- a/SunnyUI/Controls/UIScrollingText.cs +++ b/SunnyUI/Controls/UIScrollingText.cs @@ -56,6 +56,7 @@ namespace Sunny.UI ~UIScrollingText() { timer.Stop(); + timer.Dispose(); } [DefaultValue(200), Description("刷新间隔"), Category("SunnyUI")] diff --git a/SunnyUI/Controls/UITabControl.cs b/SunnyUI/Controls/UITabControl.cs index f86ded6f..95527694 100644 --- a/SunnyUI/Controls/UITabControl.cs +++ b/SunnyUI/Controls/UITabControl.cs @@ -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(); diff --git a/SunnyUI/Controls/UIWaitingBar.cs b/SunnyUI/Controls/UIWaitingBar.cs index 55c8ea29..74742cf5 100644 --- a/SunnyUI/Controls/UIWaitingBar.cs +++ b/SunnyUI/Controls/UIWaitingBar.cs @@ -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); diff --git a/SunnyUI/Units/UThunder.cs b/SunnyUI/Units/UThunder.cs index 8e7c8745..08b62dff 100644 --- a/SunnyUI/Units/UThunder.cs +++ b/SunnyUI/Units/UThunder.cs @@ -58,6 +58,12 @@ namespace Sunny.UI timer.Start(); } + ~Thunder() + { + timer.Stop(); + timer.Dispose(); + } + private void Timer_Tick(object sender, EventArgs e) { timer.Stop(); @@ -320,7 +326,7 @@ namespace Sunny.UI private static extern bool XL_UnInit(); [DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)] - private static extern IntPtr XL_CreateTask([In]DownTaskParam stParam); + private static extern IntPtr XL_CreateTask([In] DownTaskParam stParam); [DllImport("xldl.dll", CallingConvention = CallingConvention.Cdecl)] private static extern bool XL_StartTask(IntPtr hTask); @@ -358,7 +364,7 @@ namespace Sunny.UI [DllImport("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool XL_QueryTaskInfoEx(IntPtr hTask, [Out]DownTaskInfo stTaskInfo); + private static extern bool XL_QueryTaskInfoEx(IntPtr hTask, [Out] DownTaskInfo stTaskInfo); [DllImport("xldl.dll", EntryPoint = "XL_QueryTaskInfoEx", CallingConvention = CallingConvention.Cdecl)] private static extern IntPtr XL_CreateBTTask(DownBTTaskParam stParam);