* UITextBox: 支持修改背景色
This commit is contained in:
parent
2a551ae48f
commit
8017957187
Binary file not shown.
Binary file not shown.
57
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
57
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
@ -45,16 +45,16 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLabel2 = new Sunny.UI.UILabel();
|
this.uiLabel2 = new Sunny.UI.UILabel();
|
||||||
this.uiTextBox2 = new Sunny.UI.UITextBox();
|
this.uiTextBox2 = new Sunny.UI.UITextBox();
|
||||||
this.uiLabel1 = new Sunny.UI.UILabel();
|
this.uiLabel1 = new Sunny.UI.UILabel();
|
||||||
this.uiTextBox1 = new Sunny.UI.UITextBox();
|
|
||||||
this.uiIntegerUpDown1 = new Sunny.UI.UIIntegerUpDown();
|
this.uiIntegerUpDown1 = new Sunny.UI.UIIntegerUpDown();
|
||||||
this.uiToolTip1 = new Sunny.UI.UIToolTip(this.components);
|
this.uiToolTip1 = new Sunny.UI.UIToolTip(this.components);
|
||||||
|
this.uiTextBox1 = new Sunny.UI.UITextBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// uiTextBox6
|
// uiTextBox6
|
||||||
//
|
//
|
||||||
|
this.uiTextBox6.ButtonSymbol = 61761;
|
||||||
this.uiTextBox6.ButtonWidth = 100;
|
this.uiTextBox6.ButtonWidth = 100;
|
||||||
this.uiTextBox6.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.uiTextBox6.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.uiTextBox6.FillColor = System.Drawing.Color.White;
|
|
||||||
this.uiTextBox6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
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.Location = new System.Drawing.Point(117, 167);
|
||||||
this.uiTextBox6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.uiTextBox6.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
@ -71,9 +71,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiTextBox5
|
// uiTextBox5
|
||||||
//
|
//
|
||||||
|
this.uiTextBox5.ButtonSymbol = 61761;
|
||||||
this.uiTextBox5.ButtonWidth = 100;
|
this.uiTextBox5.ButtonWidth = 100;
|
||||||
this.uiTextBox5.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.uiTextBox5.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.uiTextBox5.FillColor = System.Drawing.Color.White;
|
|
||||||
this.uiTextBox5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
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.Icon = global::Sunny.UI.Demo.Properties.Resources.Home_32x32;
|
||||||
this.uiTextBox5.Location = new System.Drawing.Point(117, 128);
|
this.uiTextBox5.Location = new System.Drawing.Point(117, 128);
|
||||||
@ -90,9 +90,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiTextBox4
|
// uiTextBox4
|
||||||
//
|
//
|
||||||
|
this.uiTextBox4.ButtonSymbol = 61761;
|
||||||
this.uiTextBox4.ButtonWidth = 100;
|
this.uiTextBox4.ButtonWidth = 100;
|
||||||
this.uiTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.uiTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.uiTextBox4.FillColor = System.Drawing.Color.White;
|
|
||||||
this.uiTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
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.Location = new System.Drawing.Point(30, 325);
|
||||||
this.uiTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.uiTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
@ -209,10 +209,10 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiTextBox3
|
// uiTextBox3
|
||||||
//
|
//
|
||||||
|
this.uiTextBox3.ButtonSymbol = 61761;
|
||||||
this.uiTextBox3.ButtonWidth = 100;
|
this.uiTextBox3.ButtonWidth = 100;
|
||||||
this.uiTextBox3.CanEmpty = true;
|
this.uiTextBox3.CanEmpty = true;
|
||||||
this.uiTextBox3.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.uiTextBox3.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.uiTextBox3.FillColor = System.Drawing.Color.White;
|
|
||||||
this.uiTextBox3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiTextBox3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
this.uiTextBox3.Location = new System.Drawing.Point(117, 245);
|
this.uiTextBox3.Location = new System.Drawing.Point(117, 245);
|
||||||
this.uiTextBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.uiTextBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
@ -240,11 +240,11 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiTextBox2
|
// uiTextBox2
|
||||||
//
|
//
|
||||||
|
this.uiTextBox2.ButtonSymbol = 61761;
|
||||||
this.uiTextBox2.ButtonWidth = 100;
|
this.uiTextBox2.ButtonWidth = 100;
|
||||||
this.uiTextBox2.CanEmpty = true;
|
this.uiTextBox2.CanEmpty = true;
|
||||||
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.uiTextBox2.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.uiTextBox2.DoubleValue = 5D;
|
this.uiTextBox2.DoubleValue = 5D;
|
||||||
this.uiTextBox2.FillColor = System.Drawing.Color.White;
|
|
||||||
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiTextBox2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
this.uiTextBox2.IntValue = 5;
|
this.uiTextBox2.IntValue = 5;
|
||||||
this.uiTextBox2.Location = new System.Drawing.Point(117, 206);
|
this.uiTextBox2.Location = new System.Drawing.Point(117, 206);
|
||||||
@ -272,25 +272,6 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLabel1.Text = "String";
|
this.uiLabel1.Text = "String";
|
||||||
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
//
|
//
|
||||||
// uiTextBox1
|
|
||||||
//
|
|
||||||
this.uiTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
|
|
||||||
this.uiTextBox1.FillColor = System.Drawing.Color.White;
|
|
||||||
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);
|
|
||||||
this.uiTextBox1.Maximum = 2147483647D;
|
|
||||||
this.uiTextBox1.Minimum = -2147483648D;
|
|
||||||
this.uiTextBox1.MinimumSize = new System.Drawing.Size(1, 1);
|
|
||||||
this.uiTextBox1.Name = "uiTextBox1";
|
|
||||||
this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5);
|
|
||||||
this.uiTextBox1.ShowButton = true;
|
|
||||||
this.uiTextBox1.Size = new System.Drawing.Size(221, 29);
|
|
||||||
this.uiTextBox1.TabIndex = 0;
|
|
||||||
this.uiTextBox1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
|
||||||
this.uiToolTip1.SetToolTip(this.uiTextBox1, "Hello world!");
|
|
||||||
this.uiTextBox1.Watermark = "水印文字";
|
|
||||||
//
|
|
||||||
// uiIntegerUpDown1
|
// uiIntegerUpDown1
|
||||||
//
|
//
|
||||||
this.uiIntegerUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiIntegerUpDown1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
@ -311,6 +292,28 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiToolTip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(239)))));
|
this.uiToolTip1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(239)))), ((int)(((byte)(239)))), ((int)(((byte)(239)))));
|
||||||
this.uiToolTip1.OwnerDraw = true;
|
this.uiToolTip1.OwnerDraw = true;
|
||||||
//
|
//
|
||||||
|
// uiTextBox1
|
||||||
|
//
|
||||||
|
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.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);
|
||||||
|
this.uiTextBox1.Maximum = 2147483647D;
|
||||||
|
this.uiTextBox1.Minimum = -2147483648D;
|
||||||
|
this.uiTextBox1.MinimumSize = new System.Drawing.Size(1, 16);
|
||||||
|
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!");
|
||||||
|
this.uiTextBox1.Watermark = "水印文字";
|
||||||
|
this.uiTextBox1.ButtonClick += new System.EventHandler(this.uiTextBox1_ButtonClick);
|
||||||
|
//
|
||||||
// FTextBox
|
// FTextBox
|
||||||
//
|
//
|
||||||
this.AllowShowTitle = true;
|
this.AllowShowTitle = true;
|
||||||
@ -331,8 +334,8 @@ namespace Sunny.UI.Demo
|
|||||||
this.Controls.Add(this.uiLabel2);
|
this.Controls.Add(this.uiLabel2);
|
||||||
this.Controls.Add(this.uiTextBox2);
|
this.Controls.Add(this.uiTextBox2);
|
||||||
this.Controls.Add(this.uiLabel1);
|
this.Controls.Add(this.uiLabel1);
|
||||||
this.Controls.Add(this.uiTextBox1);
|
|
||||||
this.Controls.Add(this.uiIntegerUpDown1);
|
this.Controls.Add(this.uiIntegerUpDown1);
|
||||||
|
this.Controls.Add(this.uiTextBox1);
|
||||||
this.Name = "FTextBox";
|
this.Name = "FTextBox";
|
||||||
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
|
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
|
||||||
this.ShowTitle = true;
|
this.ShowTitle = true;
|
||||||
@ -361,8 +364,8 @@ namespace Sunny.UI.Demo
|
|||||||
private UILabel uiLabel2;
|
private UILabel uiLabel2;
|
||||||
private UITextBox uiTextBox2;
|
private UITextBox uiTextBox2;
|
||||||
private UILabel uiLabel1;
|
private UILabel uiLabel1;
|
||||||
private UITextBox uiTextBox1;
|
|
||||||
private UIIntegerUpDown uiIntegerUpDown1;
|
private UIIntegerUpDown uiIntegerUpDown1;
|
||||||
private UIToolTip uiToolTip1;
|
private UIToolTip uiToolTip1;
|
||||||
|
private UITextBox uiTextBox1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,5 +11,10 @@
|
|||||||
{
|
{
|
||||||
uiTextBox1.Focus();
|
uiTextBox1.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void uiTextBox1_ButtonClick(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
ShowInfoTip("您点击了编辑框的按钮。");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Font oldFont;
|
|
||||||
private Boolean waterMarkTextEnabled;
|
private Boolean waterMarkTextEnabled;
|
||||||
|
|
||||||
private Color _waterMarkColor = Color.Gray;
|
private Color _waterMarkColor = Color.Gray;
|
||||||
@ -83,15 +82,15 @@ namespace Sunny.UI
|
|||||||
WaterMark_Toggle(null, null);
|
WaterMark_Toggle(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs args)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
// Use the same font that was defined in base class
|
if (waterMarkTextEnabled)
|
||||||
Font drawFont = new Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit);
|
{
|
||||||
//Create new brush with gray color or
|
e.Graphics.FillRectangle(BackColor, Bounds);
|
||||||
SolidBrush drawBrush = new SolidBrush(WaterMarkColor);//use Water mark color
|
e.Graphics.DrawString(Watermark, Font, WaterMarkColor, new PointF(0.0F, 0.0F));
|
||||||
//Draw Text or WaterMark
|
}
|
||||||
args.Graphics.DrawString((waterMarkTextEnabled ? Watermark : Text), drawFont, drawBrush, new PointF(0.0F, 0.0F));
|
|
||||||
base.OnPaint(args);
|
base.OnPaint(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void JoinEvents(Boolean join)
|
private void JoinEvents(Boolean join)
|
||||||
@ -100,7 +99,8 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
TextChanged += WaterMark_Toggle;
|
TextChanged += WaterMark_Toggle;
|
||||||
LostFocus += WaterMark_Toggle;
|
LostFocus += WaterMark_Toggle;
|
||||||
FontChanged += WaterMark_FontChanged;
|
GotFocus += WaterMark_Toggle;
|
||||||
|
MouseDown += WaterMark_Toggle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,11 +114,9 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private void EnableWaterMark()
|
private void EnableWaterMark()
|
||||||
{
|
{
|
||||||
//Save current font until returning the UserPaint style to false (NOTE: It is a try and error advice)
|
|
||||||
oldFont = new Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit);
|
|
||||||
//Enable OnPaint event handler
|
//Enable OnPaint event handler
|
||||||
SetStyle(ControlStyles.UserPaint, true);
|
SetStyle(ControlStyles.UserPaint, Watermark.IsValid());
|
||||||
waterMarkTextEnabled = true;
|
waterMarkTextEnabled = Watermark.IsValid();
|
||||||
//OnPaint right now
|
//OnPaint right now
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@ -128,18 +126,6 @@ namespace Sunny.UI
|
|||||||
//Disable OnPaint event handler
|
//Disable OnPaint event handler
|
||||||
waterMarkTextEnabled = false;
|
waterMarkTextEnabled = false;
|
||||||
SetStyle(ControlStyles.UserPaint, false);
|
SetStyle(ControlStyles.UserPaint, false);
|
||||||
//Return back oldFont if existed
|
|
||||||
if (oldFont != null)
|
|
||||||
Font = new Font(oldFont.FontFamily, oldFont.Size, oldFont.Style, oldFont.Unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WaterMark_FontChanged(object sender, EventArgs args)
|
|
||||||
{
|
|
||||||
if (waterMarkTextEnabled)
|
|
||||||
{
|
|
||||||
oldFont = new Font(Font.FontFamily, Font.Size, Font.Style, Font.Unit);
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
* 2021-08-15: V3.0.6 重写了水印文字的画法,并增加水印文字颜色
|
* 2021-08-15: V3.0.6 重写了水印文字的画法,并增加水印文字颜色
|
||||||
* 2021-09-07: V3.0.6 增加按钮
|
* 2021-09-07: V3.0.6 增加按钮
|
||||||
* 2021-10-14: V3.0.8 调整最小高度限制
|
* 2021-10-14: V3.0.8 调整最小高度限制
|
||||||
|
* 2021-10-15: V3.0.8 支持修改背景色
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -88,7 +89,9 @@ namespace Sunny.UI
|
|||||||
btn.Top = 1;
|
btn.Top = 1;
|
||||||
btn.Height = 25;
|
btn.Height = 25;
|
||||||
btn.Width = 29;
|
btn.Width = 29;
|
||||||
|
btn.BackColor = Color.Transparent;
|
||||||
btn.Click += Btn_Click;
|
btn.Click += Btn_Click;
|
||||||
|
btn.Radius = 3;
|
||||||
|
|
||||||
edit.Invalidate();
|
edit.Invalidate();
|
||||||
Controls.Add(edit);
|
Controls.Add(edit);
|
||||||
@ -109,6 +112,30 @@ namespace Sunny.UI
|
|||||||
TextAlignmentChange += UITextBox_TextAlignmentChange;
|
TextAlignmentChange += UITextBox_TextAlignmentChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||||
|
/// </summary>
|
||||||
|
[Description("填充颜色,当值为背景色或透明色或空值则不填充"), Category("SunnyUI")]
|
||||||
|
[DefaultValue(typeof(Color), "White")]
|
||||||
|
public new Color FillColor
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return fillColor;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (fillColor != value)
|
||||||
|
{
|
||||||
|
fillColor = value;
|
||||||
|
_style = UIStyle.Custom;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
AfterSetFillColor(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Btn_Click(object sender, EventArgs e)
|
private void Btn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ButtonClick?.Invoke(this, e);
|
ButtonClick?.Invoke(this, e);
|
||||||
@ -217,7 +244,7 @@ namespace Sunny.UI
|
|||||||
protected override void OnEnabledChanged(EventArgs e)
|
protected override void OnEnabledChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnEnabledChanged(e);
|
base.OnEnabledChanged(e);
|
||||||
edit.BackColor = Enabled ? Color.White : FillDisableColor;
|
edit.BackColor = Enabled ? FillColor : FillDisableColor;
|
||||||
edit.Enabled = Enabled;
|
edit.Enabled = Enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,6 +515,9 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private void SizeChange()
|
private void SizeChange()
|
||||||
{
|
{
|
||||||
|
if (edit == null) return;
|
||||||
|
if (btn == null) return;
|
||||||
|
|
||||||
if (!multiline)
|
if (!multiline)
|
||||||
{
|
{
|
||||||
if (Height < 12) Height = MinHeight;
|
if (Height < 12) Height = MinHeight;
|
||||||
@ -496,14 +526,14 @@ namespace Sunny.UI
|
|||||||
if (Height < MinHeight)
|
if (Height < MinHeight)
|
||||||
{
|
{
|
||||||
edit.AutoSize = false;
|
edit.AutoSize = false;
|
||||||
edit.Height = Height - 2;
|
edit.Height = Height - 3;
|
||||||
edit.Top = 1;
|
edit.Top = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
edit.AutoSize = true;
|
edit.AutoSize = true;
|
||||||
edit.Height = MinHeight;
|
edit.Height = MinHeight;
|
||||||
edit.Top = (Height - edit.Height) / 2;
|
edit.Top = (Height - edit.Height) / 2 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon == null && Symbol == 0)
|
if (icon == null && Symbol == 0)
|
||||||
@ -525,12 +555,13 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
btn.Left = Width - 2 - ButtonWidth;
|
||||||
|
btn.Top = 2;
|
||||||
|
btn.Height = Height - 4;
|
||||||
|
|
||||||
if (ShowButton)
|
if (ShowButton)
|
||||||
{
|
{
|
||||||
btn.Left = Width - 2 - ButtonWidth;
|
edit.Width = edit.Width - btn.Width - 3;
|
||||||
btn.Top = 2;
|
|
||||||
btn.Height = Height - 4;
|
|
||||||
edit.Width = edit.Width - btn.Width - 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -578,7 +609,7 @@ namespace Sunny.UI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
edit.ReadOnly = value;
|
edit.ReadOnly = value;
|
||||||
edit.BackColor = Enabled ? Color.White : FillDisableColor;
|
edit.BackColor = Enabled ? FillColor : FillDisableColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +742,11 @@ namespace Sunny.UI
|
|||||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||||
{
|
{
|
||||||
base.SetStyleColor(uiColor);
|
base.SetStyleColor(uiColor);
|
||||||
edit.BackColor = fillColor = Enabled ? Color.White : FillDisableColor;
|
|
||||||
|
if (uiColor.IsCustom()) return;
|
||||||
|
|
||||||
|
fillColor = uiColor.EditorBackColor;
|
||||||
|
edit.BackColor = Enabled ? fillColor : FillDisableColor;
|
||||||
edit.ForeColor = foreColor = UIFontColor.Primary;
|
edit.ForeColor = foreColor = UIFontColor.Primary;
|
||||||
|
|
||||||
if (bar != null)
|
if (bar != null)
|
||||||
@ -719,7 +754,7 @@ namespace Sunny.UI
|
|||||||
bar.ForeColor = uiColor.PrimaryColor;
|
bar.ForeColor = uiColor.PrimaryColor;
|
||||||
bar.HoverColor = uiColor.ButtonFillHoverColor;
|
bar.HoverColor = uiColor.ButtonFillHoverColor;
|
||||||
bar.PressColor = uiColor.ButtonFillPressColor;
|
bar.PressColor = uiColor.ButtonFillPressColor;
|
||||||
bar.FillColor = Color.White;
|
bar.FillColor = fillColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
@ -115,6 +115,8 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public virtual bool BuiltIn => true;
|
public virtual bool BuiltIn => true;
|
||||||
|
|
||||||
|
public virtual Color EditorBackColor => Color.White;
|
||||||
|
|
||||||
public virtual void LoadFromFile()
|
public virtual void LoadFromFile()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user