* UITextBox: 按钮支持自定义颜色
This commit is contained in:
parent
278fbca08d
commit
c4f626c34a
Binary file not shown.
Binary file not shown.
17
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
17
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
@ -55,6 +55,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox6.ButtonSymbol = 61761;
|
||||
this.uiTextBox6.ButtonWidth = 100;
|
||||
this.uiTextBox6.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox6.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox6.Location = new System.Drawing.Point(117, 167);
|
||||
this.uiTextBox6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -74,6 +75,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox5.ButtonSymbol = 61761;
|
||||
this.uiTextBox5.ButtonWidth = 100;
|
||||
this.uiTextBox5.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox5.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox5.Icon = global::Sunny.UI.Demo.Properties.Resources.Home_32x32;
|
||||
this.uiTextBox5.Location = new System.Drawing.Point(117, 128);
|
||||
@ -93,6 +95,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox4.ButtonSymbol = 61761;
|
||||
this.uiTextBox4.ButtonWidth = 100;
|
||||
this.uiTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox4.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox4.Location = new System.Drawing.Point(30, 325);
|
||||
this.uiTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -113,6 +116,7 @@ namespace Sunny.UI.Demo
|
||||
// uiLine3
|
||||
//
|
||||
this.uiLine3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine3.LineDashStyle = Sunny.UI.UILineDashStyle.None;
|
||||
this.uiLine3.Location = new System.Drawing.Point(388, 286);
|
||||
this.uiLine3.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine3.Name = "uiLine3";
|
||||
@ -124,6 +128,7 @@ namespace Sunny.UI.Demo
|
||||
// uiLine2
|
||||
//
|
||||
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine2.LineDashStyle = Sunny.UI.UILineDashStyle.None;
|
||||
this.uiLine2.Location = new System.Drawing.Point(30, 286);
|
||||
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine2.Name = "uiLine2";
|
||||
@ -136,6 +141,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
this.uiRichTextBox1.AutoWordSelection = true;
|
||||
this.uiRichTextBox1.FillColor = System.Drawing.Color.White;
|
||||
this.uiRichTextBox1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiRichTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiRichTextBox1.Location = new System.Drawing.Point(388, 325);
|
||||
this.uiRichTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -153,6 +159,7 @@ namespace Sunny.UI.Demo
|
||||
// uiLine5
|
||||
//
|
||||
this.uiLine5.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine5.LineDashStyle = Sunny.UI.UILineDashStyle.None;
|
||||
this.uiLine5.Location = new System.Drawing.Point(388, 132);
|
||||
this.uiLine5.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine5.Name = "uiLine5";
|
||||
@ -164,6 +171,7 @@ namespace Sunny.UI.Demo
|
||||
// uiLine4
|
||||
//
|
||||
this.uiLine4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine4.LineDashStyle = Sunny.UI.UILineDashStyle.None;
|
||||
this.uiLine4.Location = new System.Drawing.Point(388, 55);
|
||||
this.uiLine4.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine4.Name = "uiLine4";
|
||||
@ -175,6 +183,7 @@ namespace Sunny.UI.Demo
|
||||
// uiLine1
|
||||
//
|
||||
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine1.LineDashStyle = Sunny.UI.UILineDashStyle.None;
|
||||
this.uiLine1.Location = new System.Drawing.Point(30, 55);
|
||||
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine1.Name = "uiLine1";
|
||||
@ -185,6 +194,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
// uiDoubleUpDown1
|
||||
//
|
||||
this.uiDoubleUpDown1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiDoubleUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiDoubleUpDown1.Location = new System.Drawing.Point(388, 167);
|
||||
this.uiDoubleUpDown1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -213,6 +223,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox3.ButtonWidth = 100;
|
||||
this.uiTextBox3.CanEmpty = true;
|
||||
this.uiTextBox3.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox3.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTextBox3.Location = new System.Drawing.Point(117, 245);
|
||||
this.uiTextBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -245,6 +256,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox2.CanEmpty = true;
|
||||
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox2.DoubleValue = 5D;
|
||||
this.uiTextBox2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTextBox2.IntValue = 5;
|
||||
this.uiTextBox2.Location = new System.Drawing.Point(117, 206);
|
||||
@ -274,6 +286,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
// uiIntegerUpDown1
|
||||
//
|
||||
this.uiIntegerUpDown1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiIntegerUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiIntegerUpDown1.Location = new System.Drawing.Point(388, 89);
|
||||
this.uiIntegerUpDown1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -296,7 +309,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
this.uiTextBox1.ButtonSymbol = 61761;
|
||||
this.uiTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||
this.uiTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox1.Location = new System.Drawing.Point(117, 89);
|
||||
this.uiTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
@ -306,8 +319,6 @@ namespace Sunny.UI.Demo
|
||||
this.uiTextBox1.Name = "uiTextBox1";
|
||||
this.uiTextBox1.ShowButton = true;
|
||||
this.uiTextBox1.Size = new System.Drawing.Size(221, 29);
|
||||
this.uiTextBox1.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiTextBox1.StyleCustomMode = true;
|
||||
this.uiTextBox1.TabIndex = 52;
|
||||
this.uiTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.uiToolTip1.SetToolTip(this.uiTextBox1, "Hello world!");
|
||||
|
@ -29,6 +29,7 @@
|
||||
* 2021-09-07: V3.0.6 增加按钮
|
||||
* 2021-10-14: V3.0.8 调整最小高度限制
|
||||
* 2021-10-15: V3.0.8 支持修改背景色
|
||||
* 2022-01-07: V3.1.0 按钮支持自定义颜色
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -758,6 +759,21 @@ namespace Sunny.UI
|
||||
bar.FillColor = fillColor;
|
||||
}
|
||||
|
||||
if (btn != null)
|
||||
{
|
||||
btn.ForeColor = uiColor.ButtonForeColor;
|
||||
btn.FillColor = uiColor.ButtonFillColor;
|
||||
btn.RectColor = uiColor.RectColor;
|
||||
|
||||
btn.FillHoverColor = uiColor.ButtonFillHoverColor;
|
||||
btn.RectHoverColor = uiColor.RectHoverColor;
|
||||
btn.ForeHoverColor = uiColor.ButtonForeHoverColor;
|
||||
|
||||
btn.FillPressColor = uiColor.ButtonFillPressColor;
|
||||
btn.RectPressColor = uiColor.RectPressColor;
|
||||
btn.ForePressColor = uiColor.ButtonForePressColor;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@ -1147,5 +1163,122 @@ namespace Sunny.UI
|
||||
get => btn.SymbolOffset;
|
||||
set => btn.SymbolOffset = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
[Description("按钮填充颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color ButtonFillColor
|
||||
{
|
||||
get => btn.FillColor;
|
||||
set
|
||||
{
|
||||
btn.FillColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
[Description("按钮字体颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "White")]
|
||||
public Color ButtonForeColor
|
||||
{
|
||||
get => btn.ForeColor;
|
||||
set
|
||||
{
|
||||
btn.ForeColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("按钮边框颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color ButtonRectColor
|
||||
{
|
||||
get => btn.RectColor;
|
||||
set
|
||||
{
|
||||
btn.RectColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "111, 168, 255"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标移上时填充颜色")]
|
||||
public Color ButtonFillHoverColor
|
||||
{
|
||||
get => btn.FillHoverColor;
|
||||
set
|
||||
{
|
||||
btn.FillHoverColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标移上时字体颜色")]
|
||||
public Color ButtonForeHoverColor
|
||||
{
|
||||
get => btn.ForeHoverColor;
|
||||
set
|
||||
{
|
||||
btn.ForeHoverColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "111, 168, 255"), Category("SunnyUI")]
|
||||
[Description("鼠标移上时边框颜色")]
|
||||
public Color ButtonRectHoverColor
|
||||
{
|
||||
get => btn.RectHoverColor;
|
||||
set
|
||||
{
|
||||
btn.RectHoverColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "74, 131, 229"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时填充颜色")]
|
||||
public Color ButtonFillPressColor
|
||||
{
|
||||
get => btn.FillPressColor;
|
||||
set
|
||||
{
|
||||
btn.FillPressColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时字体颜色")]
|
||||
public Color ButtonForePressColor
|
||||
{
|
||||
get => btn.ForePressColor;
|
||||
set
|
||||
{
|
||||
btn.ForePressColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "74, 131, 229"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时边框颜色")]
|
||||
public Color ButtonRectPressColor
|
||||
{
|
||||
get => btn.RectPressColor;
|
||||
set
|
||||
{
|
||||
btn.RectPressColor = value;
|
||||
_style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user