* UITextBox:更改Enabled=false的时候为一个颜色

This commit is contained in:
Sunny 2021-01-15 23:34:38 +08:00
parent a2412060f5
commit 8b466594a6
7 changed files with 26 additions and 19 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -40,11 +40,11 @@
this.uiLine4 = new Sunny.UI.UILine();
this.uiLine5 = new Sunny.UI.UILine();
this.uiRichTextBox1 = new Sunny.UI.UIRichTextBox();
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
this.aaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.uiLine2 = new Sunny.UI.UILine();
this.uiLine3 = new Sunny.UI.UILine();
this.uiTextBox4 = new Sunny.UI.UITextBox();
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
this.aaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.PagePanel.SuspendLayout();
this.uiContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
@ -230,6 +230,20 @@
this.uiRichTextBox1.Text = "Blog: https://www.cnblogs.com/yhuse\nGitee: https://gitee.com/yhuse/SunnyUI\nGitHub" +
": https://github.com/yhuse/SunnyUI\nSunnyUI.Net 系列文章目录\n欢迎交流QQ群 56829229 (SunnyU" +
"I技术交流群)请给源码项目点个Star吧";
//
// uiContextMenuStrip1
//
this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aaToolStripMenuItem});
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
this.uiContextMenuStrip1.Size = new System.Drawing.Size(99, 30);
//
// aaToolStripMenuItem
//
this.aaToolStripMenuItem.Name = "aaToolStripMenuItem";
this.aaToolStripMenuItem.Size = new System.Drawing.Size(98, 26);
this.aaToolStripMenuItem.Text = "aa";
//
// uiLine2
//
@ -273,20 +287,6 @@
"nnyUI技术交流群)请给源码项目点个Star吧";
this.uiTextBox4.Watermark = "水印文字";
//
// uiContextMenuStrip1
//
this.uiContextMenuStrip1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aaToolStripMenuItem});
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
this.uiContextMenuStrip1.Size = new System.Drawing.Size(99, 30);
//
// aaToolStripMenuItem
//
this.aaToolStripMenuItem.Name = "aaToolStripMenuItem";
this.aaToolStripMenuItem.Size = new System.Drawing.Size(98, 26);
this.aaToolStripMenuItem.Text = "aa";
//
// FTextBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);

View File

@ -84,6 +84,13 @@ namespace Sunny.UI
Leave?.Invoke(sender, e);
}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
edit.BackColor = Enabled ? Color.White : FillDisableColor;
edit.Enabled = Enabled;
}
public override bool Focused
{
get => edit.Focused;
@ -376,7 +383,7 @@ namespace Sunny.UI
set
{
edit.ReadOnly = value;
edit.BackColor = Color.White;
edit.BackColor = Enabled ? Color.White : FillDisableColor;
}
}
@ -495,7 +502,7 @@ namespace Sunny.UI
base.SetStyleColor(uiColor);
if (uiColor.IsCustom()) return;
edit.BackColor = fillColor = Color.White;
edit.BackColor = fillColor = Enabled ? Color.White : FillDisableColor;
edit.ForeColor = foreColor = UIFontColor.Primary;
if (bar != null)
@ -518,7 +525,7 @@ namespace Sunny.UI
protected override void AfterSetFillColor(Color color)
{
base.AfterSetFillColor(color);
edit.BackColor = color;
edit.BackColor = Enabled ? color : FillDisableColor;
}
public enum UIEditType