* UITitlePanel: 增加标题文字颜色

This commit is contained in:
Sunny 2021-09-03 15:05:20 +08:00
parent ee1fb615a8
commit 4b8ead5322
18 changed files with 115 additions and 89 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -30,12 +30,12 @@ using System.Windows.Forms;
namespace Sunny.UI
{
public class UIFlowLayoutPanel : UIPanel,IToolTip
public class UIFlowLayoutPanel : UIPanel, IToolTip
{
private UIVerScrollBarEx VBar;
private UIHorScrollBarEx HBar;
private FlowLayoutPanel flowLayoutPanel;
private readonly Timer timer = new Timer();
private readonly Timer timer;
public UIFlowLayoutPanel()
{
@ -56,6 +56,7 @@ namespace Sunny.UI
HBar.ValueChanged += HBar_ValueChanged;
SizeChanged += Panel_SizeChanged;
timer = new Timer();
timer.Interval = 100;
timer.Tick += Timer_Tick;
timer.Start();
@ -86,7 +87,8 @@ namespace Sunny.UI
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
timer.Stop();
timer?.Stop();
timer?.Dispose();
}
[DefaultValue(System.Windows.Forms.FlowDirection.LeftToRight)]

View File

@ -36,6 +36,7 @@ namespace Sunny.UI
SetStyleFlags(true, false);
Maximum = 100;
left_state = value_state = right_state = DrawItemState.None;
timer = new Timer();
timer.Interval = 150;
timer.Tick += TimerTick;
Width = 300;
@ -48,10 +49,11 @@ namespace Sunny.UI
fillPressColor = Color.FromArgb(74, 131, 229);
}
~UIHorScrollBar()
protected override void Dispose(bool disposing)
{
timer.Stop();
timer.Dispose();
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
private int scrollValue;
@ -64,7 +66,7 @@ namespace Sunny.UI
private int dragOffset;
private int barWidth;
private double percentValue;
private readonly Timer timer = new Timer();
private readonly Timer timer;
private bool isScrollUp = true;
private bool largeChange = true;

View File

@ -42,12 +42,13 @@ namespace Sunny.UI
private bool _on = true;
private readonly Color _reflectionColor = Color.FromArgb(180, 255, 255, 255);
private readonly Color[] _surroundColor = new Color[] { Color.FromArgb(0, 255, 255, 255) };
private readonly Timer _timer = new Timer();
private readonly Timer timer;
~UILedBulb()
protected override void Dispose(bool disposing)
{
_timer.Stop();
_timer.Dispose();
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
/// <summary>
@ -106,7 +107,8 @@ namespace Sunny.UI
Width = Height = 32;
Color = Color.FromArgb(192, 255, 192);
_timer.Tick += (sender, e) => { On = !On; };
timer = new Timer();
timer.Tick += (sender, e) => { On = !On; };
}
#endregion Constructor
@ -199,22 +201,22 @@ namespace Sunny.UI
{
blinkInterval = Math.Max(100, value);
bool isBlink = Blink;
if (isBlink) _timer.Stop();
_timer.Interval = blinkInterval;
_timer.Enabled = isBlink;
if (isBlink) timer.Stop();
timer.Interval = blinkInterval;
timer.Enabled = isBlink;
}
}
[DefaultValue(false)]
public bool Blink
{
get => _timer.Enabled;
get => timer.Enabled;
set
{
On = true;
_timer.Stop();
_timer.Interval = BlinkInterval;
_timer.Enabled = value;
timer.Stop();
timer.Interval = BlinkInterval;
timer.Enabled = value;
}
}

View File

@ -1,37 +0,0 @@
namespace Sunny.UI
{
partial class UIListBox
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
}
#endregion
}
}

View File

@ -41,11 +41,10 @@ namespace Sunny.UI
{
private readonly ListBoxEx listbox = new ListBoxEx();
private readonly UIScrollBar bar = new UIScrollBar();
private readonly Timer timer = new Timer();
private readonly Timer timer;
public UIListBox()
{
InitializeComponent();
SetStyleFlags(true, false);
ShowText = false;
Padding = new Padding(2);
@ -84,10 +83,18 @@ namespace Sunny.UI
listbox.MouseEnter += Listbox_MouseEnter;
listbox.MouseLeave += Listbox_MouseLeave;
timer = new Timer();
timer.Tick += Timer_Tick;
timer.Start();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
public new EventHandler MouseLeave;
public new EventHandler MouseEnter;
public new event KeyPressEventHandler KeyPress;
@ -293,12 +300,6 @@ namespace Sunny.UI
public new event MouseEventHandler MouseUp;
public new event MouseEventHandler MouseMove;
~UIListBox()
{
timer.Stop();
timer.Dispose();
}
private void Timer_Tick(object sender, EventArgs e)
{
if (Items.Count == 0 && LastCount != 0)

View File

@ -31,13 +31,14 @@ namespace Sunny.UI
[ToolboxItem(true)]
public sealed class UIProgressIndicator : UIControl
{
private readonly Timer timer = new Timer();
private readonly Timer timer;
public UIProgressIndicator()
{
SetStyleFlags(true, false);
Width = Height = 100;
timer = new Timer();
timer.Interval = 200;
timer.Tick += timer_Tick;
timer.Start();
@ -48,10 +49,21 @@ namespace Sunny.UI
foreColor = UIColor.Blue;
}
~UIProgressIndicator()
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
public void Start()
{
timer.Start();
}
public void Stop()
{
timer.Stop();
timer.Dispose();
}
public override void SetStyleColor(UIBaseStyle uiColor)

View File

@ -37,6 +37,7 @@ namespace Sunny.UI
SetStyleFlags(true, false);
Maximum = 100;
up_state = value_state = down_state = DrawItemState.None;
timer = new Timer();
timer.Interval = 150;
timer.Tick += TimerTick;
Width = SystemInformation.VerticalScrollBarWidth + 2;
@ -59,16 +60,17 @@ namespace Sunny.UI
private int dragOffset;
private int barHeight;
private double percentValue;
private readonly Timer timer = new Timer();
private readonly Timer timer;
private bool isScrollUp = true;
private bool largeChange = true;
public event EventHandler ValueChanged;
~UIScrollBar()
protected override void Dispose(bool disposing)
{
timer.Stop();
timer.Dispose();
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
[DefaultValue(0)]

View File

@ -31,7 +31,7 @@ namespace Sunny.UI
[ToolboxItem(true)]
public class UIScrollingText : UIControl
{
private readonly Timer timer = new Timer();
private readonly Timer timer;
private int XPos = int.MinValue;
private int XPos1 = int.MaxValue;
private int interval = 200;
@ -44,6 +44,7 @@ namespace Sunny.UI
foreColor = UIStyles.GetStyleColor(UIStyle.Blue).RectColor;
Reset();
timer = new Timer();
timer.Interval = interval;
timer.Tick += Timer_Tick;
}
@ -75,10 +76,21 @@ namespace Sunny.UI
Invalidate();
}
~UIScrollingText()
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
public void Start()
{
timer.Start();
}
public void Stop()
{
timer.Stop();
timer.Dispose();
}
[DefaultValue(200), Description("刷新间隔"), Category("SunnyUI")]

View File

@ -39,7 +39,7 @@ namespace Sunny.UI
{
private readonly UITabControlHelper Helper;
private int DrawedIndex = -1;
private readonly Timer timer = new Timer();
private readonly Timer timer;
public UITabControl()
{
@ -57,14 +57,16 @@ namespace Sunny.UI
Version = UIGlobal.Version;
Helper = new UITabControlHelper(this);
timer = new Timer();
timer.Interval = 500;
timer.Tick += Timer_Tick;
}
~UITabControl()
protected override void Dispose(bool disposing)
{
timer.Stop();
timer.Dispose();
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
private string mainPage = "";

View File

@ -19,6 +19,7 @@
* 2020-01-01: V2.2.0
* 2020-04-25: V2.2.4
* 2020-07-30: V2.2.6
* 2020-09-03: V3.0.6
******************************************************************************/
using System;
@ -63,7 +64,6 @@ namespace Sunny.UI
InitializeComponent();
SetStyleFlags(true, false);
ShowText = false;
foreColor = Color.White;
CalcSystemBoxPos();
}
@ -71,7 +71,7 @@ namespace Sunny.UI
{
base.SetStyleColor(uiColor);
titleColor = uiColor.TitleColor;
foreColor = uiColor.TitleForeColor;
titleForeColor = uiColor.TitleForeColor;
Invalidate();
}
@ -92,6 +92,21 @@ namespace Sunny.UI
}
}
private Color titleForeColor = Color.White;
[DefaultValue(typeof(Color), "White")]
[Description("标题文字颜色"), Category("SunnyUI")]
public Color TitleForeColor
{
get => titleForeColor;
set
{
titleForeColor = value;
_style = UIStyle.Custom;
Invalidate();
}
}
private Color titleColor = UIColor.Blue;
[DefaultValue(typeof(Color), "80, 160, 255")]
@ -119,7 +134,7 @@ namespace Sunny.UI
Color color = Enabled ? TitleColor : UIDisableColor.Fill;
g.FillPath(color, path);
color = Enabled ? ForeColor : UIFontColor.Regular;
color = Enabled ? TitleForeColor : UIFontColor.Regular;
SizeF sf = g.MeasureString(Text, Font);
switch (TextAlign)
{

View File

@ -29,7 +29,7 @@ namespace Sunny.UI
[ToolboxItem(true)]
public sealed class UIWaitingBar : UIControl
{
private readonly Timer timer = new Timer();
private readonly Timer timer;
public UIWaitingBar()
{
@ -40,15 +40,27 @@ namespace Sunny.UI
fillColor = UIColor.LightBlue;
foreColor = UIColor.Blue;
timer = new Timer();
timer.Interval = 200;
timer.Tick += Timer_Tick;
timer.Start();
}
~UIWaitingBar()
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
timer?.Stop();
timer?.Dispose();
}
public void Start()
{
timer.Start();
}
public void Stop()
{
timer.Stop();
timer.Dispose();
}
protected override void OnPaint(PaintEventArgs e)

View File

@ -68,7 +68,8 @@ namespace Sunny.UI
public void Dispose()
{
Active = false;
timer.Stop();
timer?.Stop();
timer?.Dispose();
Image?.Dispose();
Image = null;
ShowImage?.Dispose();

View File

@ -32,7 +32,7 @@ namespace Sunny.UI
{
public class Thunder : IDisposable
{
private readonly Timer timer = new Timer();
private readonly Timer timer;
private bool Exit;
public delegate void OnTaskInfoChange(object sender, ThunderTask task);
@ -52,7 +52,7 @@ namespace Sunny.UI
public Thunder()
{
InitSuccess = ThunderDll.Init();
timer = new Timer();
timer.Interval = 1000;
timer.Tick += Timer_Tick;
timer.Start();
@ -60,8 +60,8 @@ namespace Sunny.UI
~Thunder()
{
timer.Stop();
timer.Dispose();
timer?.Stop();
timer?.Dispose();
}
private void Timer_Tick(object sender, EventArgs e)