* UIToolTip:更新ToolTip

This commit is contained in:
Sunny 2020-07-25 22:51:03 +08:00
parent eafc4ddab3
commit 99360a354c
6 changed files with 8 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -168,7 +168,7 @@
this.uiButton1.StyleCustomMode = true;
this.uiButton1.TabIndex = 0;
this.uiButton1.Text = "White";
this.uiButton1.TipsText = "White";
this.uiToolTip1.SetToolTip(this.uiButton1, "White");
//
// uiButton2
//
@ -181,7 +181,7 @@
this.uiButton2.StyleCustomMode = true;
this.uiButton2.TabIndex = 1;
this.uiButton2.Text = "Blue";
this.uiButton2.TipsText = "Blue";
this.uiToolTip1.SetToolTip(this.uiButton2, "Blue");
//
// uiButton3
//
@ -989,6 +989,7 @@
// uiToolTip1
//
this.uiToolTip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54)))));
this.uiToolTip1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiToolTip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(239)))));
this.uiToolTip1.OwnerDraw = true;
this.uiToolTip1.ToolTipTitle = "ToolTip title";

View File

@ -6,6 +6,9 @@ using System.Windows.Forms;
namespace Sunny.UI
{
[ProvideProperty("ToolTip", typeof(Control))]
[DefaultEvent("Popup")]
[ToolboxItemFilter("System.Windows.Forms")]
public class UIToolTip : ToolTip
{
private readonly ConcurrentDictionary<Control, ToolTipControl> ToolTipControls =
@ -121,9 +124,9 @@ namespace Sunny.UI
ToolTipControls.TryRemove(control, out _);
}
public new ToolTipControl GetToolTip(Control control)
public new string GetToolTip(Control control)
{
return ToolTipControls.ContainsKey(control) ? ToolTipControls[control] : new ToolTipControl();
return ToolTipControls.ContainsKey(control) ? ToolTipControls[control].Description : "";
}
private void InitOwnerDraw()