* UIHeaderButton:增加ShowSelected,是否显示选中状态

This commit is contained in:
Sunny 2021-06-22 15:51:04 +08:00
parent 0af1224e2d
commit dafc427626
11 changed files with 192 additions and 59 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
namespace Sunny.UI.Demo.Charts 
namespace Sunny.UI.Demo
{ {
partial class FBarChart partial class FBarChart
{ {
@ -28,71 +29,40 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.BarChart = new Sunny.UI.UIBarChart();
this.uiLine1 = new Sunny.UI.UILine();
this.uiSymbolButton1 = new Sunny.UI.UISymbolButton(); this.uiSymbolButton1 = new Sunny.UI.UISymbolButton();
this.uiImageButton3 = new Sunny.UI.UIImageButton(); this.uiImageButton3 = new Sunny.UI.UIImageButton();
this.uiImageButton2 = new Sunny.UI.UIImageButton(); this.uiImageButton2 = new Sunny.UI.UIImageButton();
this.uiImageButton1 = new Sunny.UI.UIImageButton(); this.uiImageButton1 = new Sunny.UI.UIImageButton();
this.PagePanel.SuspendLayout(); this.uiLine1 = new Sunny.UI.UILine();
this.BarChart = new Sunny.UI.UIBarChart();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// PagePanel
//
this.PagePanel.Controls.Add(this.uiSymbolButton1);
this.PagePanel.Controls.Add(this.uiImageButton3);
this.PagePanel.Controls.Add(this.uiImageButton2);
this.PagePanel.Controls.Add(this.uiImageButton1);
this.PagePanel.Controls.Add(this.uiLine1);
this.PagePanel.Controls.Add(this.BarChart);
this.PagePanel.Size = new System.Drawing.Size(800, 528);
//
// BarChart
//
this.BarChart.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
this.BarChart.Font = new System.Drawing.Font("微软雅黑", 12F);
this.BarChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54)))));
this.BarChart.Location = new System.Drawing.Point(30, 48);
this.BarChart.Name = "BarChart";
this.BarChart.Size = new System.Drawing.Size(670, 400);
this.BarChart.TabIndex = 0;
this.BarChart.Text = "uiBarChart1";
//
// uiLine1
//
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine1.Location = new System.Drawing.Point(30, 20);
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 = 20;
this.uiLine1.Text = "UIBarChart";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// uiSymbolButton1 // uiSymbolButton1
// //
this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton1.Location = new System.Drawing.Point(348, 466); this.uiSymbolButton1.Location = new System.Drawing.Point(348, 503);
this.uiSymbolButton1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton1.Name = "uiSymbolButton1"; this.uiSymbolButton1.Name = "uiSymbolButton1";
this.uiSymbolButton1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.uiSymbolButton1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.uiSymbolButton1.Size = new System.Drawing.Size(100, 27); this.uiSymbolButton1.Size = new System.Drawing.Size(100, 27);
this.uiSymbolButton1.Symbol = 61952; this.uiSymbolButton1.Symbol = 61952;
this.uiSymbolButton1.TabIndex = 28; this.uiSymbolButton1.TabIndex = 34;
this.uiSymbolButton1.Text = "数据"; this.uiSymbolButton1.Text = "数据";
this.uiSymbolButton1.Click += new System.EventHandler(this.uiSymbolButton1_Click); this.uiSymbolButton1.Click += new System.EventHandler(this.uiSymbolButton1_Click);
// //
// uiImageButton3 // uiImageButton3
// //
this.uiImageButton3.Cursor = System.Windows.Forms.Cursors.Hand; this.uiImageButton3.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiImageButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton3.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDarkStyle; this.uiImageButton3.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDarkStyle;
this.uiImageButton3.Location = new System.Drawing.Point(242, 466); this.uiImageButton3.Location = new System.Drawing.Point(242, 503);
this.uiImageButton3.Name = "uiImageButton3"; this.uiImageButton3.Name = "uiImageButton3";
this.uiImageButton3.Size = new System.Drawing.Size(100, 27); this.uiImageButton3.Size = new System.Drawing.Size(100, 27);
this.uiImageButton3.TabIndex = 27; this.uiImageButton3.TabIndex = 33;
this.uiImageButton3.TabStop = false; this.uiImageButton3.TabStop = false;
this.uiImageButton3.Text = " Dark"; this.uiImageButton3.Text = " Dark";
this.uiImageButton3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiImageButton3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -101,11 +71,12 @@
// uiImageButton2 // uiImageButton2
// //
this.uiImageButton2.Cursor = System.Windows.Forms.Cursors.Hand; this.uiImageButton2.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiImageButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton2.Image = global::Sunny.UI.Demo.Properties.Resources.ChartPlainStyle; this.uiImageButton2.Image = global::Sunny.UI.Demo.Properties.Resources.ChartPlainStyle;
this.uiImageButton2.Location = new System.Drawing.Point(136, 466); this.uiImageButton2.Location = new System.Drawing.Point(136, 503);
this.uiImageButton2.Name = "uiImageButton2"; this.uiImageButton2.Name = "uiImageButton2";
this.uiImageButton2.Size = new System.Drawing.Size(100, 27); this.uiImageButton2.Size = new System.Drawing.Size(100, 27);
this.uiImageButton2.TabIndex = 26; this.uiImageButton2.TabIndex = 32;
this.uiImageButton2.TabStop = false; this.uiImageButton2.TabStop = false;
this.uiImageButton2.Text = " Plain"; this.uiImageButton2.Text = " Plain";
this.uiImageButton2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiImageButton2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@ -114,25 +85,56 @@
// uiImageButton1 // uiImageButton1
// //
this.uiImageButton1.Cursor = System.Windows.Forms.Cursors.Hand; this.uiImageButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiImageButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton1.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDefaultStyle; this.uiImageButton1.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDefaultStyle;
this.uiImageButton1.Location = new System.Drawing.Point(30, 466); this.uiImageButton1.Location = new System.Drawing.Point(30, 503);
this.uiImageButton1.Name = "uiImageButton1"; this.uiImageButton1.Name = "uiImageButton1";
this.uiImageButton1.Size = new System.Drawing.Size(100, 27); this.uiImageButton1.Size = new System.Drawing.Size(100, 27);
this.uiImageButton1.TabIndex = 25; this.uiImageButton1.TabIndex = 31;
this.uiImageButton1.TabStop = false; this.uiImageButton1.TabStop = false;
this.uiImageButton1.Text = " Default"; this.uiImageButton1.Text = " Default";
this.uiImageButton1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.uiImageButton1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uiImageButton1.Click += new System.EventHandler(this.uiImageButton1_Click); this.uiImageButton1.Click += new System.EventHandler(this.uiImageButton1_Click);
// //
// uiLine1
//
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine1.Location = new System.Drawing.Point(30, 55);
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 = 30;
this.uiLine1.Text = "UIBarChart";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// BarChart
//
this.BarChart.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
this.BarChart.Font = new System.Drawing.Font("微软雅黑", 12F);
this.BarChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54)))));
this.BarChart.Location = new System.Drawing.Point(30, 85);
this.BarChart.MinimumSize = new System.Drawing.Size(1, 1);
this.BarChart.Name = "BarChart";
this.BarChart.Size = new System.Drawing.Size(670, 400);
this.BarChart.TabIndex = 29;
this.BarChart.Text = "uiBarChart1";
//
// FBarChart // FBarChart
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F); this.AllowShowTitle = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 563); this.ClientSize = new System.Drawing.Size(800, 606);
this.Controls.Add(this.uiSymbolButton1);
this.Controls.Add(this.uiImageButton3);
this.Controls.Add(this.uiImageButton2);
this.Controls.Add(this.uiImageButton1);
this.Controls.Add(this.uiLine1);
this.Controls.Add(this.BarChart);
this.Name = "FBarChart"; this.Name = "FBarChart";
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
this.ShowTitle = true;
this.Symbol = 61568; this.Symbol = 61568;
this.Text = "BarChart"; this.Text = "BarChart";
this.PagePanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).EndInit();
@ -142,11 +144,11 @@
#endregion #endregion
private UIBarChart BarChart;
private UILine uiLine1;
private UISymbolButton uiSymbolButton1; private UISymbolButton uiSymbolButton1;
private UIImageButton uiImageButton3; private UIImageButton uiImageButton3;
private UIImageButton uiImageButton2; private UIImageButton uiImageButton2;
private UIImageButton uiImageButton1; private UIImageButton uiImageButton1;
private UILine uiLine1;
private UIBarChart BarChart;
} }
} }

View File

@ -1,8 +1,8 @@
using System.Drawing; using System.Drawing;
namespace Sunny.UI.Demo.Charts namespace Sunny.UI.Demo
{ {
public partial class FBarChart : UITitlePage public partial class FBarChart : UIPage
{ {
public FBarChart() public FBarChart()
{ {
@ -84,4 +84,4 @@ namespace Sunny.UI.Demo.Charts
BarChart.ChartStyleType = UIChartStyleType.Dark; BarChart.ChartStyleType = UIChartStyleType.Dark;
} }
} }
} }

View File

@ -0,0 +1,120 @@
<?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">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -57,12 +57,6 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Charts\FBarChart.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Charts\FBarChart.Designer.cs">
<DependentUpon>FBarChart.cs</DependentUpon>
</Compile>
<Compile Include="Charts\FBarChartEx.cs"> <Compile Include="Charts\FBarChartEx.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -159,6 +153,12 @@
<Compile Include="Controls\FListBox.Designer.cs"> <Compile Include="Controls\FListBox.Designer.cs">
<DependentUpon>FListBox.cs</DependentUpon> <DependentUpon>FListBox.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Charts\FBarChart.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Charts\FBarChart.Designer.cs">
<DependentUpon>FBarChart.cs</DependentUpon>
</Compile>
<Compile Include="FMain.cs"> <Compile Include="FMain.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -380,6 +380,9 @@
<EmbeddedResource Include="Controls\FListBox.resx"> <EmbeddedResource Include="Controls\FListBox.resx">
<DependentUpon>FListBox.cs</DependentUpon> <DependentUpon>FListBox.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Charts\FBarChart.resx">
<DependentUpon>FBarChart.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FMain.resx"> <EmbeddedResource Include="FMain.resx">
<DependentUpon>FMain.cs</DependentUpon> <DependentUpon>FMain.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -79,12 +79,20 @@ namespace Sunny.UI
button.Selected = false; button.Selected = false;
} }
Selected = true; if (ShowSelected)
{
Selected = true;
}
TabControl?.SelectPage(PageIndex); TabControl?.SelectPage(PageIndex);
base.OnClick(e); base.OnClick(e);
} }
[DefaultValue(true)]
[Description("显示选中状态"), Category("SunnyUI")]
public bool ShowSelected { get; set; } = true;
public event EventHandler SelectedChanged; public event EventHandler SelectedChanged;
private int _symbolSize = 48; private int _symbolSize = 48;