* UIDropControl: 下拉框控件增加Tips小红点

* UITextBox: 增加Tips小红点
This commit is contained in:
Sunny 2023-02-07 21:24:12 +08:00
parent b26c3ea100
commit 30b5c92b93
2 changed files with 107 additions and 0 deletions

View File

@ -20,6 +20,7 @@
* 2020-04-25: V2.2.4
* 2020-07-05: V2.2.6 KeyDownKeyUpKeyPress事件
* 2022-09-16: V3.2.4
* 2023-02-07: V3.3.1 Tips小红点
******************************************************************************/
using System;
@ -73,6 +74,56 @@ namespace Sunny.UI
ControlBoxRect = new Rectangle(Width - 24, 0, 24, Height);
}
private UIButton tipsBtn;
public void SetTipsText(ToolTip toolTip, string text)
{
if (tipsBtn == null)
{
tipsBtn = new UIButton();
tipsBtn.Cursor = System.Windows.Forms.Cursors.Hand;
tipsBtn.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.Location = new System.Drawing.Point(285, 519);
tipsBtn.MinimumSize = new System.Drawing.Size(1, 1);
tipsBtn.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.Size = new System.Drawing.Size(9, 9);
tipsBtn.Style = Sunny.UI.UIStyle.Red;
tipsBtn.StyleCustomMode = true;
tipsBtn.TabIndex = 118;
tipsBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
tipsBtn.Text = "";
tipsBtn.Click += TipsBtn_Click;
Controls.Add(tipsBtn);
tipsBtn.Location = new System.Drawing.Point(Width - 11, 2);
tipsBtn.BringToFront();
}
toolTip.SetToolTip(tipsBtn, text);
}
public event EventHandler TipsClick;
private void TipsBtn_Click(object sender, EventArgs e)
{
TipsClick?.Invoke(this, EventArgs.Empty);
}
public void CloseTips()
{
if (tipsBtn != null)
{
tipsBtn.Click -= TipsBtn_Click;
tipsBtn.Dispose();
tipsBtn = null;
}
}
protected override void OnContextMenuStripChanged(EventArgs e)
{
base.OnContextMenuStripChanged(e);
@ -317,6 +368,11 @@ namespace Sunny.UI
protected override void OnSizeChanged(EventArgs e)
{
SizeChange();
if (tipsBtn != null)
{
tipsBtn.Location = new System.Drawing.Point(Width - 11, 2);
}
}
private void SizeChange()

View File

@ -44,6 +44,7 @@
* 2022-11-12: V3.2.8
* 2022-11-12: V3.2.8 MaximumEnabledMinimumEnabledHasMaximumHasMinimum属性
* 2022-11-26: V3.2.9 MouseClickMouseDoubleClick事件
* 2023-02-07: V3.3.1 Tips小红点
******************************************************************************/
using System;
@ -134,6 +135,56 @@ namespace Sunny.UI
TextAlignmentChange += UITextBox_TextAlignmentChange;
}
private UIButton tipsBtn;
public void SetTipsText(ToolTip toolTip, string text)
{
if (tipsBtn == null)
{
tipsBtn = new UIButton();
tipsBtn.Cursor = System.Windows.Forms.Cursors.Hand;
tipsBtn.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.Location = new System.Drawing.Point(285, 519);
tipsBtn.MinimumSize = new System.Drawing.Size(1, 1);
tipsBtn.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
tipsBtn.Size = new System.Drawing.Size(9, 9);
tipsBtn.Style = Sunny.UI.UIStyle.Red;
tipsBtn.StyleCustomMode = true;
tipsBtn.TabIndex = 118;
tipsBtn.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
tipsBtn.Text = "";
tipsBtn.Click += TipsBtn_Click;
Controls.Add(tipsBtn);
tipsBtn.Location = new System.Drawing.Point(Width - 11, 2);
tipsBtn.BringToFront();
}
toolTip.SetToolTip(tipsBtn, text);
}
public event EventHandler TipsClick;
private void TipsBtn_Click(object sender, EventArgs e)
{
TipsClick?.Invoke(this, EventArgs.Empty);
}
public void CloseTips()
{
if (tipsBtn != null)
{
tipsBtn.Click -= TipsBtn_Click;
tipsBtn.Dispose();
tipsBtn = null;
}
}
public new event EventHandler MouseDoubleClick;
public new event EventHandler MouseClick;