* UIButton:Tips颜色可设置

This commit is contained in:
Sunny 2020-09-14 21:31:09 +08:00
parent 7b0b79da56
commit 81c8b43879
9 changed files with 30 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -174,6 +174,7 @@
this.uiButton1.StyleCustomMode = true;
this.uiButton1.TabIndex = 0;
this.uiButton1.Text = "White";
this.uiButton1.TipsText = "1";
this.uiToolTip1.SetToolTip(this.uiButton1, "White");
//
// uiButton2

View File

@ -120,9 +120,6 @@
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>52</value>
</metadata>

View File

@ -188,6 +188,7 @@
this.edtDate.Font = new System.Drawing.Font("微软雅黑", 12F);
this.edtDate.Location = new System.Drawing.Point(150, 215);
this.edtDate.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtDate.MaxLength = 10;
this.edtDate.MinimumSize = new System.Drawing.Size(63, 0);
this.edtDate.Name = "edtDate";
this.edtDate.Padding = new System.Windows.Forms.Padding(0, 0, 30, 0);

View File

@ -146,6 +146,19 @@ namespace Sunny.UI
}
}
private Color tipsColor = Color.Red;
[DefaultValue(typeof(Color), "Red")]
public Color TipsColor
{
get => tipsColor;
set
{
tipsColor = value;
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
@ -157,7 +170,7 @@ namespace Sunny.UI
float sfMax = Math.Max(sf.Width, sf.Height);
float x = Width - 1 - 2 - sfMax;
float y = 1 + 1;
e.Graphics.FillEllipse(UIColor.Red, x, y, sfMax, sfMax);
e.Graphics.FillEllipse(TipsColor, x, y, sfMax, sfMax);
e.Graphics.DrawString(TipsText, TipsFont, Color.White, x + sfMax / 2.0f - sf.Width / 2.0f, y + sfMax / 2.0f - sf.Height / 2.0f);
}

View File

@ -494,12 +494,25 @@ namespace Sunny.UI
float tipsLeft = Width - (ScrollBarVisible ? 50 : 30) - 6 - sfMax;
float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2;
e.Graphics.FillEllipse(UIColor.Red, tipsLeft, tipsTop, sfMax, sfMax);
e.Graphics.FillEllipse(TipsColor, tipsLeft, tipsTop, sfMax, sfMax);
e.Graphics.DrawString(MenuHelper.GetTipsText(e.Node), TipsFont, Color.White, tipsLeft + sfMax / 2.0f - tipsSize.Width / 2.0f, tipsTop + 1 + sfMax / 2.0f - tipsSize.Height / 2.0f);
}
}
}
private Color tipsColor = Color.Red;
[DefaultValue(typeof(Color), "Red")]
public Color TipsColor
{
get => tipsColor;
set
{
tipsColor = value;
Invalidate();
}
}
private bool TreeNodeSelected(DrawTreeNodeEventArgs e)
{
return e.State == TreeNodeStates.Selected || e.State == TreeNodeStates.Focused ||