* UIStyle: 更新了放在TableLayoutPanel里控件的自定义颜色问题。

This commit is contained in:
Sunny 2021-07-27 17:26:54 +08:00
parent 1f86b55dea
commit 8e063a722c
7 changed files with 43 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,6 +20,7 @@
******************************************************************************/ ******************************************************************************/
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
@ -37,6 +38,18 @@ namespace Sunny.UI
fillColor = Color.White; fillColor = Color.White;
StyleCustomMode = true; StyleCustomMode = true;
Style = UIStyle.Custom; Style = UIStyle.Custom;
Width = 200;
Height = 16;
}
private List<UIPipe> linked = new List<UIPipe>();
public void Link(UIPipe pipe)
{
if (linked.IndexOf(pipe) < 0)
{
linked.Add(pipe);
}
} }
private UILine.LineDirection direction = UILine.LineDirection.Horizontal; private UILine.LineDirection direction = UILine.LineDirection.Horizontal;
@ -48,9 +61,25 @@ namespace Sunny.UI
get => direction; get => direction;
set set
{ {
Radius = 0; if (direction != value)
direction = value; {
Invalidate(); Radius = 0;
direction = value;
if (direction == UILine.LineDirection.Horizontal)
{
Width = 200;
Height = 16;
}
if (direction == UILine.LineDirection.Vertical)
{
Width = 16;
Height = 200;
}
Invalidate();
}
} }
} }
@ -368,6 +397,8 @@ namespace Sunny.UI
g.DrawLine(colors[idx], 0, Height - i, Width - i, Height - i); g.DrawLine(colors[idx], 0, Height - i, Width - i, Height - i);
} }
} }
} }
PaintFlow(g); PaintFlow(g);

View File

@ -797,6 +797,8 @@ namespace Sunny.UI
if (obj is UIFlowLayoutPanel) continue; if (obj is UIFlowLayoutPanel) continue;
if (obj is UIPanel) continue; if (obj is UIPanel) continue;
if (obj is TableLayoutPanel) continue;
if (obj.Controls.Count > 0) if (obj.Controls.Count > 0)
{ {
values.AddRange(obj.GetUIStyleControls(interfaceName)); values.AddRange(obj.GetUIStyleControls(interfaceName));
@ -835,21 +837,23 @@ namespace Sunny.UI
{ {
if (control is IStyleInterface item) if (control is IStyleInterface item)
{ {
item.Style = style; if (!item.StyleCustomMode)
item.Style = style;
} }
} }
return; return;
} }
if (e.Control is TableLayoutPanel) if (e.Control is FlowLayoutPanel)
{ {
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface"); List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
foreach (var control in controls) foreach (var control in controls)
{ {
if (control is IStyleInterface item) if (control is IStyleInterface item)
{ {
item.Style = style; if (!item.StyleCustomMode)
item.Style = style;
} }
} }
@ -863,7 +867,8 @@ namespace Sunny.UI
{ {
if (control is IStyleInterface item) if (control is IStyleInterface item)
{ {
item.Style = style; if (!item.StyleCustomMode)
item.Style = style;
} }
} }
} }