* UIListBox,UIImageListBox:背景色可改,设置FillColor,以及SystemCustomMode = true

This commit is contained in:
Sunny 2020-09-28 23:10:38 +08:00
parent c51f20f860
commit f2e53bf4fe
8 changed files with 40 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -49,11 +49,13 @@
// //
// uiImageListBox1 // uiImageListBox1
// //
this.uiImageListBox1.FillColor = System.Drawing.Color.White;
this.uiImageListBox1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiImageListBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageListBox1.ItemHeight = 80; this.uiImageListBox1.ItemHeight = 80;
this.uiImageListBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); this.uiImageListBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiImageListBox1.Location = new System.Drawing.Point(355, 48); this.uiImageListBox1.Location = new System.Drawing.Point(355, 48);
this.uiImageListBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiImageListBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiImageListBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiImageListBox1.Name = "uiImageListBox1"; this.uiImageListBox1.Name = "uiImageListBox1";
this.uiImageListBox1.Padding = new System.Windows.Forms.Padding(2); this.uiImageListBox1.Padding = new System.Windows.Forms.Padding(2);
this.uiImageListBox1.Size = new System.Drawing.Size(266, 343); this.uiImageListBox1.Size = new System.Drawing.Size(266, 343);
@ -85,10 +87,12 @@
// //
// uiListBox1 // uiListBox1
// //
this.uiListBox1.FillColor = System.Drawing.Color.White;
this.uiListBox1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiListBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiListBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); this.uiListBox1.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiListBox1.Location = new System.Drawing.Point(33, 48); this.uiListBox1.Location = new System.Drawing.Point(33, 48);
this.uiListBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.uiListBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.uiListBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiListBox1.Name = "uiListBox1"; this.uiListBox1.Name = "uiListBox1";
this.uiListBox1.Padding = new System.Windows.Forms.Padding(2); this.uiListBox1.Padding = new System.Windows.Forms.Padding(2);
this.uiListBox1.Size = new System.Drawing.Size(270, 343); this.uiListBox1.Size = new System.Drawing.Size(270, 343);
@ -102,6 +106,7 @@
this.uiCheckBox1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiCheckBox1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiCheckBox1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiCheckBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiCheckBox1.Location = new System.Drawing.Point(355, 399); this.uiCheckBox1.Location = new System.Drawing.Point(355, 399);
this.uiCheckBox1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiCheckBox1.Name = "uiCheckBox1"; this.uiCheckBox1.Name = "uiCheckBox1";
this.uiCheckBox1.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0); this.uiCheckBox1.Padding = new System.Windows.Forms.Padding(22, 0, 0, 0);
this.uiCheckBox1.Size = new System.Drawing.Size(266, 35); this.uiCheckBox1.Size = new System.Drawing.Size(266, 35);
@ -114,6 +119,7 @@
this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiButton1.Location = new System.Drawing.Point(33, 400); this.uiButton1.Location = new System.Drawing.Point(33, 400);
this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiButton1.Name = "uiButton1"; this.uiButton1.Name = "uiButton1";
this.uiButton1.Size = new System.Drawing.Size(100, 35); this.uiButton1.Size = new System.Drawing.Size(100, 35);
this.uiButton1.TabIndex = 23; this.uiButton1.TabIndex = 23;

View File

@ -132,8 +132,6 @@
this.uiTreeView1.SelectedNode = null; this.uiTreeView1.SelectedNode = null;
this.uiTreeView1.ShowLines = true; this.uiTreeView1.ShowLines = true;
this.uiTreeView1.Size = new System.Drawing.Size(266, 313); this.uiTreeView1.Size = new System.Drawing.Size(266, 313);
this.uiTreeView1.Style = Sunny.UI.UIStyle.Custom;
this.uiTreeView1.StyleCustomMode = true;
this.uiTreeView1.TabIndex = 0; this.uiTreeView1.TabIndex = 0;
this.uiTreeView1.Text = null; this.uiTreeView1.Text = null;
// //

View File

@ -66,6 +66,20 @@ namespace Sunny.UI
listbox.MouseMove += Listbox_MouseMove; listbox.MouseMove += Listbox_MouseMove;
} }
protected override void AfterSetFillColor(Color color)
{
base.AfterSetFillColor(color);
if (listbox != null)
{
listbox.BackColor = color;
}
if (bar != null)
{
bar.FillColor = color;
}
}
private void Listbox_MouseMove(object sender, MouseEventArgs e) private void Listbox_MouseMove(object sender, MouseEventArgs e)
{ {
MouseMove?.Invoke(this, e); MouseMove?.Invoke(this, e);
@ -187,7 +201,10 @@ namespace Sunny.UI
{ {
listbox.HoverColor = hoverColor; listbox.HoverColor = hoverColor;
listbox.SetStyleColor(uiColor); listbox.SetStyleColor(uiColor);
listbox.BackColor = Color.White;
} }
fillColor = Color.White;
} }
private int LastCount; private int LastCount;

View File

@ -26,7 +26,6 @@ using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Design; using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Windows.Forms; using System.Windows.Forms;
namespace Sunny.UI namespace Sunny.UI
@ -188,6 +187,23 @@ namespace Sunny.UI
{ {
listbox.HoverColor = hoverColor; listbox.HoverColor = hoverColor;
listbox.SetStyleColor(uiColor); listbox.SetStyleColor(uiColor);
listbox.BackColor = Color.White;
}
fillColor = Color.White;
}
protected override void AfterSetFillColor(Color color)
{
base.AfterSetFillColor(color);
if (listbox != null)
{
listbox.BackColor = color;
}
if (bar != null)
{
bar.FillColor = color;
} }
} }
@ -213,11 +229,6 @@ namespace Sunny.UI
Padding = new Padding(Math.Max(2, value / 2)); Padding = new Padding(Math.Max(2, value / 2));
} }
protected override void OnPaintFill(Graphics g, GraphicsPath path)
{
g.Clear(Color.White);
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[Localizable(true)] [Localizable(true)]
[Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] [Editor("System.Windows.Forms.Design.ListControlStringCollectionEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]