+ UITableLayoutPanel:增加控件
* UIStyle:调整以支持UIFlowLayoutPanel子控件
This commit is contained in:
parent
d5627bb965
commit
5335680cb3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6
SunnyUI.Demo/Controls/FNavigation.Designer.cs
generated
6
SunnyUI.Demo/Controls/FNavigation.Designer.cs
generated
@ -145,7 +145,7 @@ namespace Sunny.UI.Demo
|
||||
this.uiNavMenu2.HoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
|
||||
this.uiNavMenu2.ItemHeight = 50;
|
||||
this.uiNavMenu2.Location = new System.Drawing.Point(299, 192);
|
||||
this.uiNavMenu2.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
|
||||
this.uiNavMenu2.MenuStyle = Sunny.UI.UIMenuStyle.White;
|
||||
this.uiNavMenu2.Name = "uiNavMenu2";
|
||||
treeNode1.Name = "节点14";
|
||||
treeNode1.Text = "节点14";
|
||||
@ -205,9 +205,10 @@ namespace Sunny.UI.Demo
|
||||
treeNode20,
|
||||
treeNode21});
|
||||
this.uiNavMenu2.SecondBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
|
||||
this.uiNavMenu2.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
|
||||
this.uiNavMenu2.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250)))));
|
||||
this.uiNavMenu2.ShowLines = false;
|
||||
this.uiNavMenu2.Size = new System.Drawing.Size(253, 353);
|
||||
this.uiNavMenu2.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiNavMenu2.TabIndex = 22;
|
||||
//
|
||||
// uiNavMenu1
|
||||
@ -352,7 +353,6 @@ namespace Sunny.UI.Demo
|
||||
// FNavigation
|
||||
//
|
||||
this.AllowShowTitle = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(800, 603);
|
||||
this.Controls.Add(this.uiLine2);
|
||||
|
119
SunnyUI.Demo/Controls/FPanel.Designer.cs
generated
119
SunnyUI.Demo/Controls/FPanel.Designer.cs
generated
@ -33,12 +33,20 @@ namespace Sunny.UI.Demo
|
||||
this.uiTitlePanel2 = new Sunny.UI.UITitlePanel();
|
||||
this.uiGroupBox1 = new Sunny.UI.UIGroupBox();
|
||||
this.uiTitlePanel1 = new Sunny.UI.UITitlePanel();
|
||||
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
|
||||
this.uiButton1 = new Sunny.UI.UIButton();
|
||||
this.uiButton2 = new Sunny.UI.UIButton();
|
||||
this.uiLine1 = new Sunny.UI.UILine();
|
||||
this.uiLine2 = new Sunny.UI.UILine();
|
||||
this.uiButton3 = new Sunny.UI.UIButton();
|
||||
this.uiButton4 = new Sunny.UI.UIButton();
|
||||
this.uiTableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// uiPanel1
|
||||
//
|
||||
this.uiPanel1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiPanel1.Location = new System.Drawing.Point(30, 55);
|
||||
this.uiPanel1.Location = new System.Drawing.Point(30, 90);
|
||||
this.uiPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiPanel1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiPanel1.Name = "uiPanel1";
|
||||
@ -51,7 +59,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
this.uiTitlePanel2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTitlePanel2.ForeColor = System.Drawing.Color.White;
|
||||
this.uiTitlePanel2.Location = new System.Drawing.Point(331, 250);
|
||||
this.uiTitlePanel2.Location = new System.Drawing.Point(331, 285);
|
||||
this.uiTitlePanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiTitlePanel2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiTitlePanel2.Name = "uiTitlePanel2";
|
||||
@ -65,7 +73,7 @@ namespace Sunny.UI.Demo
|
||||
// uiGroupBox1
|
||||
//
|
||||
this.uiGroupBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiGroupBox1.Location = new System.Drawing.Point(331, 39);
|
||||
this.uiGroupBox1.Location = new System.Drawing.Point(331, 74);
|
||||
this.uiGroupBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiGroupBox1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiGroupBox1.Name = "uiGroupBox1";
|
||||
@ -79,7 +87,7 @@ namespace Sunny.UI.Demo
|
||||
//
|
||||
this.uiTitlePanel1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTitlePanel1.ForeColor = System.Drawing.Color.White;
|
||||
this.uiTitlePanel1.Location = new System.Drawing.Point(30, 250);
|
||||
this.uiTitlePanel1.Location = new System.Drawing.Point(30, 285);
|
||||
this.uiTitlePanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiTitlePanel1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiTitlePanel1.Name = "uiTitlePanel1";
|
||||
@ -89,11 +97,104 @@ namespace Sunny.UI.Demo
|
||||
this.uiTitlePanel1.Text = "uiTitlePanel1";
|
||||
this.uiTitlePanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// uiTableLayoutPanel1
|
||||
//
|
||||
this.uiTableLayoutPanel1.ColumnCount = 4;
|
||||
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.uiTableLayoutPanel1.Controls.Add(this.uiButton4, 3, 0);
|
||||
this.uiTableLayoutPanel1.Controls.Add(this.uiButton3, 2, 0);
|
||||
this.uiTableLayoutPanel1.Controls.Add(this.uiButton2, 1, 0);
|
||||
this.uiTableLayoutPanel1.Controls.Add(this.uiButton1, 0, 0);
|
||||
this.uiTableLayoutPanel1.Location = new System.Drawing.Point(30, 508);
|
||||
this.uiTableLayoutPanel1.Name = "uiTableLayoutPanel1";
|
||||
this.uiTableLayoutPanel1.RowCount = 1;
|
||||
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.uiTableLayoutPanel1.Size = new System.Drawing.Size(354, 41);
|
||||
this.uiTableLayoutPanel1.TabIndex = 10;
|
||||
this.uiTableLayoutPanel1.TagString = null;
|
||||
//
|
||||
// uiButton1
|
||||
//
|
||||
this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uiButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton1.Location = new System.Drawing.Point(3, 3);
|
||||
this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton1.Name = "uiButton1";
|
||||
this.uiButton1.Size = new System.Drawing.Size(82, 35);
|
||||
this.uiButton1.TabIndex = 0;
|
||||
this.uiButton1.Text = "uiButton1";
|
||||
//
|
||||
// uiButton2
|
||||
//
|
||||
this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uiButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton2.Location = new System.Drawing.Point(91, 3);
|
||||
this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton2.Name = "uiButton2";
|
||||
this.uiButton2.Size = new System.Drawing.Size(82, 35);
|
||||
this.uiButton2.TabIndex = 1;
|
||||
this.uiButton2.Text = "uiButton2";
|
||||
//
|
||||
// uiLine1
|
||||
//
|
||||
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine1.Location = new System.Drawing.Point(30, 479);
|
||||
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine1.Name = "uiLine1";
|
||||
this.uiLine1.Size = new System.Drawing.Size(670, 20);
|
||||
this.uiLine1.TabIndex = 78;
|
||||
this.uiLine1.Text = "UITableLayoutPanel";
|
||||
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// uiLine2
|
||||
//
|
||||
this.uiLine2.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiLine2.Location = new System.Drawing.Point(30, 55);
|
||||
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
||||
this.uiLine2.Name = "uiLine2";
|
||||
this.uiLine2.Size = new System.Drawing.Size(670, 20);
|
||||
this.uiLine2.TabIndex = 79;
|
||||
this.uiLine2.Text = "UIPanel";
|
||||
this.uiLine2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// uiButton3
|
||||
//
|
||||
this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uiButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton3.Location = new System.Drawing.Point(179, 3);
|
||||
this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton3.Name = "uiButton3";
|
||||
this.uiButton3.Size = new System.Drawing.Size(82, 35);
|
||||
this.uiButton3.TabIndex = 4;
|
||||
this.uiButton3.Text = "uiButton3";
|
||||
//
|
||||
// uiButton4
|
||||
//
|
||||
this.uiButton4.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiButton4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.uiButton4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiButton4.Location = new System.Drawing.Point(267, 3);
|
||||
this.uiButton4.MinimumSize = new System.Drawing.Size(1, 1);
|
||||
this.uiButton4.Name = "uiButton4";
|
||||
this.uiButton4.Size = new System.Drawing.Size(84, 35);
|
||||
this.uiButton4.TabIndex = 5;
|
||||
this.uiButton4.Text = "uiButton4";
|
||||
//
|
||||
// FPanel
|
||||
//
|
||||
this.AllowShowTitle = true;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(800, 494);
|
||||
this.ClientSize = new System.Drawing.Size(800, 662);
|
||||
this.Controls.Add(this.uiLine2);
|
||||
this.Controls.Add(this.uiLine1);
|
||||
this.Controls.Add(this.uiTableLayoutPanel1);
|
||||
this.Controls.Add(this.uiPanel1);
|
||||
this.Controls.Add(this.uiTitlePanel2);
|
||||
this.Controls.Add(this.uiGroupBox1);
|
||||
@ -103,6 +204,7 @@ namespace Sunny.UI.Demo
|
||||
this.ShowTitle = true;
|
||||
this.Symbol = 61590;
|
||||
this.Text = "Panel";
|
||||
this.uiTableLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -113,5 +215,12 @@ namespace Sunny.UI.Demo
|
||||
private UITitlePanel uiTitlePanel2;
|
||||
private UIGroupBox uiGroupBox1;
|
||||
private UITitlePanel uiTitlePanel1;
|
||||
private UITableLayoutPanel uiTableLayoutPanel1;
|
||||
private UIButton uiButton2;
|
||||
private UIButton uiButton1;
|
||||
private UILine uiLine1;
|
||||
private UILine uiLine2;
|
||||
private UIButton uiButton4;
|
||||
private UIButton uiButton3;
|
||||
}
|
||||
}
|
Binary file not shown.
@ -1,59 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v5.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"SunnyUI.Net5.Demo/3.0.5": {
|
||||
"dependencies": {
|
||||
"SunnyUI": "3.0.5"
|
||||
},
|
||||
"runtime": {
|
||||
"SunnyUI.Net5.Demo.dll": {}
|
||||
}
|
||||
},
|
||||
"SunnyUI/3.0.5": {
|
||||
"dependencies": {
|
||||
"SunnyUI.Common": "3.0.5"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net5.0-windows7.0/SunnyUI.dll": {
|
||||
"assemblyVersion": "3.0.5.0",
|
||||
"fileVersion": "3.0.5.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SunnyUI.Common/3.0.5": {
|
||||
"runtime": {
|
||||
"lib/net5.0/SunnyUI.Common.dll": {
|
||||
"assemblyVersion": "3.0.5.0",
|
||||
"fileVersion": "3.0.5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"SunnyUI.Net5.Demo/3.0.5": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"SunnyUI/3.0.5": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-0+U39GWGWBQFmoZom+UOzuST9FxsbUol5RWZgnBLzfGDlR+O4C72HjQ38u9G/SppWBswr5+dmGvFYHBA2HS4uQ==",
|
||||
"path": "sunnyui/3.0.5",
|
||||
"hashPath": "sunnyui.3.0.5.nupkg.sha512"
|
||||
},
|
||||
"SunnyUI.Common/3.0.5": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-bP9fQW8P4fJAV6FfU2Xfw3MtOduLoj/j+MRfdIn3eq9bGqDepg/w5/xqXi393Vuxvxk24eY9+5YMRVyeS+tiRg==",
|
||||
"path": "sunnyui.common/3.0.5",
|
||||
"hashPath": "sunnyui.common.3.0.5.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"additionalProbingPaths": [
|
||||
"C:\\Users\\Sunny\\.dotnet\\store\\|arch|\\|tfm|",
|
||||
"C:\\Users\\Sunny\\.nuget\\packages",
|
||||
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
|
||||
]
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net5.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.WindowsDesktop.App",
|
||||
"version": "5.0.0"
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -145,18 +145,28 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void AddControl(Control ctrl)
|
||||
public void AddControl(Control control)
|
||||
{
|
||||
Panel.Controls.Add(ctrl);
|
||||
if (control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
Panel.Controls.Add(control);
|
||||
}
|
||||
|
||||
public void RemoveControl(Control ctrl)
|
||||
public void RemoveControl(Control control)
|
||||
{
|
||||
Panel.Controls.Remove(ctrl);
|
||||
Panel.Controls.Remove(control);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (Control control in Panel.Controls)
|
||||
{
|
||||
control.Dispose();
|
||||
}
|
||||
|
||||
Panel.Controls.Clear();
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,6 @@ namespace Sunny.UI
|
||||
|
||||
protected override void OnPaintRect(Graphics g, GraphicsPath path)
|
||||
{
|
||||
g.Clear(fillColor);
|
||||
if (Direction == LineDirection.Horizontal)
|
||||
{
|
||||
int top = (Height - lineSize) / 2;
|
||||
|
@ -21,7 +21,6 @@
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
@ -148,26 +147,10 @@ namespace Sunny.UI
|
||||
|
||||
if (e.Control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode)
|
||||
{
|
||||
ctrl.Style = Style;
|
||||
}
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
if (e.Control is Panel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
if (!item.StyleCustomMode)
|
||||
{
|
||||
item.Style = Style;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UIStyleHelper.SetRawControlStyle(e, Style);
|
||||
}
|
||||
|
||||
private UICornerRadiusSides _radiusSides = UICornerRadiusSides.All;
|
||||
@ -508,7 +491,7 @@ namespace Sunny.UI
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SetChildUIStyle(style);
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
UIBaseStyle uiColor = UIStyles.GetStyleColor(style);
|
||||
if (!uiColor.IsCustom()) SetStyleColor(uiColor);
|
||||
|
68
SunnyUI/Controls/UITableLayoutPanel.cs
Normal file
68
SunnyUI/Controls/UITableLayoutPanel.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public class UITableLayoutPanel : TableLayoutPanel, IStyleInterface
|
||||
{
|
||||
public UITableLayoutPanel()
|
||||
{
|
||||
Version = UIGlobal.Version;
|
||||
}
|
||||
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
base.OnControlAdded(e);
|
||||
|
||||
if (e.Control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
UIStyleHelper.SetRawControlStyle(e, Style);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义主题风格
|
||||
/// </summary>
|
||||
[DefaultValue(false)]
|
||||
[Description("获取或设置可以自定义主题风格"), Category("SunnyUI")]
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected UIStyle _style = UIStyle.Blue;
|
||||
|
||||
/// <summary>
|
||||
/// 主题样式
|
||||
/// </summary>
|
||||
[DefaultValue(UIStyle.Blue), Description("主题样式"), Category("SunnyUI")]
|
||||
public UIStyle Style
|
||||
{
|
||||
get => _style;
|
||||
set => SetStyle(value);
|
||||
}
|
||||
|
||||
public string Version
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public string TagString
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
{
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
_style = style;
|
||||
}
|
||||
|
||||
public void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
@ -144,7 +144,10 @@ namespace Sunny.UI
|
||||
|
||||
[DefaultValue(null)]
|
||||
[Description("扩展按钮菜单"), Category("SunnyUI")]
|
||||
public UIContextMenuStrip ExtendMenu { get; set; }
|
||||
public UIContextMenuStrip ExtendMenu
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
//不显示FormBorderStyle属性
|
||||
[Browsable(false)]
|
||||
@ -152,8 +155,14 @@ namespace Sunny.UI
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new FormBorderStyle FormBorderStyle
|
||||
{
|
||||
get { return base.FormBorderStyle; }
|
||||
set { base.FormBorderStyle = FormBorderStyle.None; }
|
||||
get
|
||||
{
|
||||
return base.FormBorderStyle;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
}
|
||||
|
||||
public void Render()
|
||||
@ -178,26 +187,10 @@ namespace Sunny.UI
|
||||
|
||||
if (e.Control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode)
|
||||
{
|
||||
ctrl.Style = Style;
|
||||
}
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
if (e.Control is Panel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
if (!item.StyleCustomMode)
|
||||
{
|
||||
item.Style = Style;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UIStyleHelper.SetRawControlStyle(e, Style);
|
||||
|
||||
if (ShowTitle && !AllowAddControlOnTitle && e.Control.Top < TitleHeight)
|
||||
{
|
||||
@ -210,7 +203,10 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("获取或设置包含有关控件的数据的对象字符串"), Category("SunnyUI")]
|
||||
public string TagString { get; set; }
|
||||
public string TagString
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示窗体的标题栏
|
||||
@ -303,7 +299,10 @@ namespace Sunny.UI
|
||||
/// 当前控件的版本
|
||||
/// </summary>
|
||||
[Description("控件版本"), Category("SunnyUI")]
|
||||
public string Version { get; }
|
||||
public string Version
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
@ -783,7 +782,10 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
[Description("是否屏蔽Alt+F4"), Category("Key")]
|
||||
[DefaultValue(false)]
|
||||
public bool IsForbidAltF4 { get; set; }
|
||||
public bool IsForbidAltF4
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e)
|
||||
{
|
||||
@ -1065,11 +1067,14 @@ namespace Sunny.UI
|
||||
|
||||
[Description("自定义主题模式(开启后全局主题更改将对当前窗体无效)"), Category("SunnyUI")]
|
||||
[DefaultValue(false)]
|
||||
public bool StyleCustomMode { get; set; }
|
||||
public bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SetChildUIStyle(style);
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
btn.SetStyle(style);
|
||||
|
||||
UIBaseStyle uiColor = UIStyles.GetStyleColor(style);
|
||||
@ -1362,7 +1367,10 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
[Description("窗体关闭时提示文字,为空则不提示"), Category("SunnyUI"), DefaultValue(null)]
|
||||
public string CloseAskString { get; set; }
|
||||
public string CloseAskString
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
|
@ -20,7 +20,6 @@
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@ -222,29 +221,12 @@ namespace Sunny.UI
|
||||
protected override void OnControlAdded(ControlEventArgs e)
|
||||
{
|
||||
base.OnControlAdded(e);
|
||||
|
||||
if (e.Control is IStyleInterface ctrl)
|
||||
{
|
||||
if (!ctrl.StyleCustomMode)
|
||||
{
|
||||
ctrl.Style = Style;
|
||||
}
|
||||
if (!ctrl.StyleCustomMode) ctrl.Style = Style;
|
||||
}
|
||||
|
||||
if (e.Control is Panel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
if (!item.StyleCustomMode)
|
||||
{
|
||||
item.Style = Style;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UIStyleHelper.SetRawControlStyle(e, Style);
|
||||
|
||||
if (AllowShowTitle && !AllowAddControlOnTitle && e.Control.Top < TitleHeight)
|
||||
{
|
||||
@ -298,7 +280,7 @@ namespace Sunny.UI
|
||||
|
||||
public void SetStyle(UIStyle style)
|
||||
{
|
||||
this.SetChildUIStyle(style);
|
||||
UIStyleHelper.SetChildUIStyle(this, style);
|
||||
|
||||
UIBaseStyle uiColor = UIStyles.GetStyleColor(style);
|
||||
if (!uiColor.IsCustom()) SetStyleColor(uiColor);
|
||||
|
@ -30,13 +30,25 @@ namespace Sunny.UI
|
||||
{
|
||||
public interface IStyleInterface
|
||||
{
|
||||
UIStyle Style { get; set; }
|
||||
UIStyle Style
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
bool StyleCustomMode { get; set; }
|
||||
bool StyleCustomMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
string Version { get; }
|
||||
string Version
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
string TagString { get; set; }
|
||||
string TagString
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
void SetStyleColor(UIBaseStyle uiColor);
|
||||
|
||||
@ -727,23 +739,10 @@ namespace Sunny.UI
|
||||
return !style.IsCustom();
|
||||
}
|
||||
|
||||
public static void SetChildUIStyle(this UIPanel ctrl, UIStyle style)
|
||||
public static void SetChildUIStyle(Control ctrl, UIStyle style)
|
||||
{
|
||||
SetControlChildUIStyle(ctrl, style);
|
||||
}
|
||||
ctrl.SuspendLayout();
|
||||
|
||||
public static void SetChildUIStyle(this UIForm ctrl, UIStyle style)
|
||||
{
|
||||
SetControlChildUIStyle(ctrl, style);
|
||||
}
|
||||
|
||||
public static void SetChildUIStyle(this UIPage ctrl, UIStyle style)
|
||||
{
|
||||
SetControlChildUIStyle(ctrl, style);
|
||||
}
|
||||
|
||||
private static void SetControlChildUIStyle(Control ctrl, UIStyle style)
|
||||
{
|
||||
List<Control> controls = ctrl.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
@ -768,6 +767,8 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctrl.ResumeLayout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -788,6 +789,8 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
if (obj is UIPage) continue;
|
||||
if (obj is UITableLayoutPanel) continue;
|
||||
if (obj is UIFlowLayoutPanel) continue;
|
||||
if (obj is UIPanel) continue;
|
||||
|
||||
if (obj.Controls.Count > 0)
|
||||
@ -798,5 +801,48 @@ namespace Sunny.UI
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public static void SetRawControlStyle(ControlEventArgs e, UIStyle style)
|
||||
{
|
||||
if (e.Control is TableLayoutPanel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
item.Style = style;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Control is TableLayoutPanel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
item.Style = style;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Control is Panel)
|
||||
{
|
||||
List<Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
|
||||
foreach (var control in controls)
|
||||
{
|
||||
if (control is IStyleInterface item)
|
||||
{
|
||||
item.Style = style;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user