* UIForm: 修复修改Style后,BackColor未保存的问题

* UIPage: 修复修改Style后,BackColor未保存的问题
This commit is contained in:
Sunny 2023-12-04 22:03:51 +08:00
parent a1923f32c6
commit a354af7552
7 changed files with 174 additions and 33 deletions

View File

@ -51,6 +51,7 @@
* 2023-10-09: V3.5.0
* 2023-11-05: V3.5.2
* 2023-11-19: V3.5.2 ShowShadow边框阴影打开ShowRadius显示圆角关闭
* 2023-12-04: V3.6.1 Style后BackColor未保存的问题
******************************************************************************/
using System;
@ -93,7 +94,6 @@ namespace Sunny.UI
ControlBoxCloseFillHoverColor = UIStyles.Blue.FormControlBoxCloseFillHoverColor;
rectColor = UIStyles.Blue.FormRectColor;
ForeColor = UIStyles.Blue.FormForeColor;
BackColor = UIStyles.Blue.FormBackColor;
titleColor = UIStyles.Blue.FormTitleColor;
titleForeColor = UIStyles.Blue.FormTitleForeColor;
}
@ -1384,10 +1384,21 @@ namespace Sunny.UI
}
}
[Description("背景颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "Control")]
public override Color BackColor
{
get => base.BackColor;
set => base.BackColor = value;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None;
if (base.BackColor == SystemColors.Control) base.BackColor = UIStyles.Blue.PageBackColor;
Render();
CalcSystemBoxPos();
SetRadius();

View File

@ -40,23 +40,22 @@ namespace Sunny.UI
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
SuspendLayout();
//
// UIForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.ClientSize = new System.Drawing.Size(800, 480);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "UIForm";
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "UIForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIForm_FormClosing);
this.ResumeLayout(false);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
ClientSize = new System.Drawing.Size(800, 480);
DoubleBuffered = true;
Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
Name = "UIForm";
Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "UIForm";
FormClosing += UIForm_FormClosing;
ResumeLayout(false);
}
#endregion

View File

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -30,23 +30,23 @@
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
SuspendLayout();
//
// UIPage
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(802, 460);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Margin = new System.Windows.Forms.Padding(5);
this.Name = "UIPage";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "UIPage";
this.ResumeLayout(false);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
ClientSize = new System.Drawing.Size(802, 460);
DoubleBuffered = true;
Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
Margin = new System.Windows.Forms.Padding(5);
Name = "UIPage";
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = System.Windows.Forms.FormStartPosition.Manual;
Text = "UIPage";
ResumeLayout(false);
}
#endregion

View File

@ -41,6 +41,7 @@
* 2023-10-09: V3.5.0
* 2023-10-26: V3.5.1 SymbolRotate
* 2023-11-06: V3.5.2
* 2023-12-04: V3.6.1 Style后BackColor未保存的问题
******************************************************************************/
using System;
@ -99,7 +100,6 @@ namespace Sunny.UI
Version = UIGlobal.Version;
SetDPIScale();
BackColor = UIStyles.Blue.PageBackColor;
_rectColor = UIStyles.Blue.PageRectColor;
ForeColor = UIStyles.Blue.PageForeColor;
titleFillColor = UIStyles.Blue.PageTitleFillColor;
@ -486,6 +486,14 @@ namespace Sunny.UI
Init();
}
[Description("背景颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "Control")]
public override Color BackColor
{
get => base.BackColor;
set => base.BackColor = value;
}
private bool IsShown;
private System.Windows.Forms.Timer AfterShownTimer;
public event EventHandler AfterShown;
@ -493,7 +501,10 @@ namespace Sunny.UI
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
if (AutoScaleMode == AutoScaleMode.Font) AutoScaleMode = AutoScaleMode.None;
if (base.BackColor == SystemColors.Control) base.BackColor = UIStyles.Blue.PageBackColor;
IsShown = true;
if (AfterShown != null)

View File

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -9,7 +9,7 @@
<Description>SunnyUI.Net 是基于.Net Framework 4.0~4.8、.Net6、.Net7 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。</Description>
<Copyright>CopyRight © SunnyUI.Net 2012-2023</Copyright>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<Version>3.6.1.0</Version>
<Version>3.6.2.0</Version>
<Authors>ShenYonghua</Authors>
<Company>SunnyUI.Net</Company>
<PackageId>SunnyUI</PackageId>