Commit 26aec14f HZH

开关文字支持自定义颜色

1 个父辈 90b35cf9
...@@ -57,6 +57,18 @@ namespace HZH_Controls.Controls ...@@ -57,6 +57,18 @@ namespace HZH_Controls.Controls
Refresh(); Refresh();
} }
} }
private Color m_trueTextColr = Color.White;
[Description("选中时文本颜色"), Category("自定义")]
public Color TrueTextColr
{
get { return m_trueTextColr; }
set
{
m_trueTextColr = value;
Refresh();
}
}
/// <summary> /// <summary>
/// The m false color /// The m false color
...@@ -78,6 +90,19 @@ namespace HZH_Controls.Controls ...@@ -78,6 +90,19 @@ namespace HZH_Controls.Controls
} }
} }
private Color m_falseTextColr = Color.White;
[Description("没有选中时文本颜色"), Category("自定义")]
public Color FalseTextColr
{
get { return m_falseTextColr; }
set
{
m_falseTextColr = value;
Refresh();
}
}
/// <summary> /// <summary>
/// The m checked /// The m checked
/// </summary> /// </summary>
...@@ -233,7 +258,7 @@ namespace HZH_Controls.Controls ...@@ -233,7 +258,7 @@ namespace HZH_Controls.Controls
{ {
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font); System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2; int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - 2 - 4) / 2, intTextY)); g.DrawString(strText, Font, new SolidBrush(m_trueTextColr), new Point((this.Height - 2 - 4) / 2, intTextY));
} }
} }
else else
...@@ -247,7 +272,7 @@ namespace HZH_Controls.Controls ...@@ -247,7 +272,7 @@ namespace HZH_Controls.Controls
{ {
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font); System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2; int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - 2 - (this.Height - 2 - 4) / 2 - ((this.Height - 2 - 4) / 2) / 2 - (int)sizeF.Width / 2, intTextY)); g.DrawString(strText, Font, new SolidBrush(m_falseTextColr), new Point(this.Width - 2 - (this.Height - 2 - 4) / 2 - ((this.Height - 2 - 4) / 2) / 2 - (int)sizeF.Width / 2, intTextY));
} }
} }
} }
...@@ -293,7 +318,7 @@ namespace HZH_Controls.Controls ...@@ -293,7 +318,7 @@ namespace HZH_Controls.Controls
{ {
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font); System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2; int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2;
g.DrawString(strText, Font, Brushes.White, new Point((this.Height - 2 - 4) / 2, intTextY)); g.DrawString(strText, Font, new SolidBrush(m_trueTextColr), new Point((this.Height - 2 - 4) / 2, intTextY));
} }
} }
else else
...@@ -314,7 +339,7 @@ namespace HZH_Controls.Controls ...@@ -314,7 +339,7 @@ namespace HZH_Controls.Controls
{ {
System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font); System.Drawing.SizeF sizeF = g.MeasureString(strText.Replace(" ", "A"), Font);
int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2; int intTextY = (this.Height - (int)sizeF.Height) / 2 + 2;
g.DrawString(strText, Font, Brushes.White, new Point(this.Width - 2 - (this.Height - 2 - 4) / 2 - ((this.Height - 2 - 4) / 2) / 2 - (int)sizeF.Width / 2, intTextY)); g.DrawString(strText, Font, new SolidBrush(m_falseTextColr), new Point(this.Width - 2 - (this.Height - 2 - 4) / 2 - ((this.Height - 2 - 4) / 2) / 2 - (int)sizeF.Width / 2, intTextY));
} }
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>$id$</id> <id>$id$</id>
<version>1.0.9</version> <version>1.0.10</version>
<title>HZHControls</title> <title>HZHControls</title>
<authors>HuangZhengHui</authors> <authors>HuangZhengHui</authors>
<owners>HuangZhengHui</owners> <owners>HuangZhengHui</owners>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!