* 重构主题

This commit is contained in:
Sunny 2023-11-13 15:12:42 +08:00
parent 03d9f43d68
commit c84f876f97
5 changed files with 74 additions and 11 deletions

View File

@ -1222,7 +1222,7 @@ namespace Sunny.UI
set => SetStyle(value);
}
public void SetInheritedStyle(UIStyle style)
public virtual void SetInheritedStyle(UIStyle style)
{
if (!DesignMode)
{
@ -1241,7 +1241,7 @@ namespace Sunny.UI
}
}
private void SetStyle(UIStyle style)
protected virtual void SetStyle(UIStyle style)
{
this.SuspendLayout();

View File

@ -48,13 +48,12 @@
uiAvatar1.MinimumSize = new System.Drawing.Size(1, 1);
uiAvatar1.Name = "uiAvatar1";
uiAvatar1.Size = new System.Drawing.Size(60, 60);
uiAvatar1.Style = UIStyle.Custom;
uiAvatar1.TabIndex = 4;
uiAvatar1.Text = "uiAvatar1";
//
// uiLine1
//
uiLine1.BackColor = System.Drawing.Color.White;
uiLine1.BackColor = System.Drawing.Color.Transparent;
uiLine1.FillColor = System.Drawing.Color.White;
uiLine1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
uiLine1.LineColor2 = System.Drawing.Color.FromArgb(80, 160, 255);
@ -81,7 +80,6 @@
edtUser.Padding = new System.Windows.Forms.Padding(5);
edtUser.ShowText = false;
edtUser.Size = new System.Drawing.Size(182, 29);
edtUser.Style = UIStyle.Custom;
edtUser.Symbol = 61447;
edtUser.SymbolSize = 22;
edtUser.TabIndex = 0;
@ -100,7 +98,6 @@
edtPassword.PasswordChar = '*';
edtPassword.ShowText = false;
edtPassword.Size = new System.Drawing.Size(182, 29);
edtPassword.Style = UIStyle.Custom;
edtPassword.Symbol = 61475;
edtPassword.SymbolSize = 22;
edtPassword.TabIndex = 1;
@ -118,7 +115,6 @@
btnLogin.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
btnLogin.ShowFocusColor = true;
btnLogin.Size = new System.Drawing.Size(86, 29);
btnLogin.Style = UIStyle.Custom;
btnLogin.TabIndex = 2;
btnLogin.Text = "登录";
btnLogin.Click += btnLogin_Click;
@ -142,7 +138,7 @@
btnCancel.RectSelectedColor = System.Drawing.Color.FromArgb(184, 64, 64);
btnCancel.ShowFocusColor = true;
btnCancel.Size = new System.Drawing.Size(86, 29);
btnCancel.Style = UIStyle.Red;
btnCancel.Style = UIStyle.Custom;
btnCancel.StyleCustomMode = true;
btnCancel.Symbol = 61453;
btnCancel.TabIndex = 3;

View File

@ -137,6 +137,13 @@ namespace Sunny.UI
}
}
protected override void SetStyle(UIStyle style)
{
base.SetStyle(style);
uiLine1.SetStyleColor(style.Colors());
uiLine1.FillColor = UIColor.White;
}
[Description("确认按钮事件"), Category("SunnyUI")]
public event EventHandler ButtonLoginClick;

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

@ -541,7 +541,7 @@ namespace Sunny.UI
Finalize?.Invoke(this, new EventArgs());
}
public void SetInheritedStyle(UIStyle style)
public virtual void SetInheritedStyle(UIStyle style)
{
if (!DesignMode)
{
@ -560,7 +560,7 @@ namespace Sunny.UI
}
}
private void SetStyle(UIStyle style)
protected virtual void SetStyle(UIStyle style)
{
this.SuspendLayout();