+ UIPieChart:新增;* UITextBox:修复设置为MultiLine时刷新问题
This commit is contained in:
parent
4082eb91c8
commit
1ed77fed88
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
136
SunnyUI.Demo/Charts/FPieChart.Designer.cs
generated
Normal file
136
SunnyUI.Demo/Charts/FPieChart.Designer.cs
generated
Normal file
@ -0,0 +1,136 @@
|
||||
namespace Sunny.UI.Demo.Controls
|
||||
{
|
||||
partial class FPieChart
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.uiLine1 = new Sunny.UI.UILine();
|
||||
this.PieChart = new Sunny.UI.UIPieChart();
|
||||
this.uiImageButton1 = new Sunny.UI.UIImageButton();
|
||||
this.uiImageButton2 = new Sunny.UI.UIImageButton();
|
||||
this.uiImageButton3 = new Sunny.UI.UIImageButton();
|
||||
this.PagePanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PagePanel
|
||||
//
|
||||
this.PagePanel.Controls.Add(this.uiImageButton3);
|
||||
this.PagePanel.Controls.Add(this.uiImageButton2);
|
||||
this.PagePanel.Controls.Add(this.uiImageButton1);
|
||||
this.PagePanel.Controls.Add(this.PieChart);
|
||||
this.PagePanel.Controls.Add(this.uiLine1);
|
||||
this.PagePanel.Size = new System.Drawing.Size(800, 461);
|
||||
//
|
||||
// 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 = 19;
|
||||
this.uiLine1.Text = "UIPieChart";
|
||||
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// PieChart
|
||||
//
|
||||
this.PieChart.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.PieChart.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.PieChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54)))));
|
||||
this.PieChart.Location = new System.Drawing.Point(26, 59);
|
||||
this.PieChart.Name = "PieChart";
|
||||
this.PieChart.Option = null;
|
||||
this.PieChart.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
||||
this.PieChart.Size = new System.Drawing.Size(566, 358);
|
||||
this.PieChart.TabIndex = 20;
|
||||
this.PieChart.Text = "uiPieChart1";
|
||||
//
|
||||
// uiImageButton1
|
||||
//
|
||||
this.uiImageButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiImageButton1.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDefaultStyle;
|
||||
this.uiImageButton1.Location = new System.Drawing.Point(604, 60);
|
||||
this.uiImageButton1.Name = "uiImageButton1";
|
||||
this.uiImageButton1.Size = new System.Drawing.Size(95, 27);
|
||||
this.uiImageButton1.TabIndex = 21;
|
||||
this.uiImageButton1.TabStop = false;
|
||||
this.uiImageButton1.Text = " Default";
|
||||
this.uiImageButton1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.uiImageButton1.Click += new System.EventHandler(this.uiImageButton1_Click);
|
||||
//
|
||||
// uiImageButton2
|
||||
//
|
||||
this.uiImageButton2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiImageButton2.Image = global::Sunny.UI.Demo.Properties.Resources.ChartPlainStyle;
|
||||
this.uiImageButton2.Location = new System.Drawing.Point(604, 93);
|
||||
this.uiImageButton2.Name = "uiImageButton2";
|
||||
this.uiImageButton2.Size = new System.Drawing.Size(95, 27);
|
||||
this.uiImageButton2.TabIndex = 22;
|
||||
this.uiImageButton2.TabStop = false;
|
||||
this.uiImageButton2.Text = " Plain";
|
||||
this.uiImageButton2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.uiImageButton2.Click += new System.EventHandler(this.uiImageButton2_Click);
|
||||
//
|
||||
// uiImageButton3
|
||||
//
|
||||
this.uiImageButton3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.uiImageButton3.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDarkStyle;
|
||||
this.uiImageButton3.Location = new System.Drawing.Point(604, 126);
|
||||
this.uiImageButton3.Name = "uiImageButton3";
|
||||
this.uiImageButton3.Size = new System.Drawing.Size(95, 27);
|
||||
this.uiImageButton3.TabIndex = 23;
|
||||
this.uiImageButton3.TabStop = false;
|
||||
this.uiImageButton3.Text = " Dark";
|
||||
this.uiImageButton3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.uiImageButton3.Click += new System.EventHandler(this.uiImageButton3_Click);
|
||||
//
|
||||
// FPieChart
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 496);
|
||||
this.Name = "FPieChart";
|
||||
this.Text = "PieChart";
|
||||
this.PagePanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private UILine uiLine1;
|
||||
private UIPieChart PieChart;
|
||||
private UIImageButton uiImageButton1;
|
||||
private UIImageButton uiImageButton3;
|
||||
private UIImageButton uiImageButton2;
|
||||
}
|
||||
}
|
25
SunnyUI.Demo/Charts/FPieChart.cs
Normal file
25
SunnyUI.Demo/Charts/FPieChart.cs
Normal file
@ -0,0 +1,25 @@
|
||||
namespace Sunny.UI.Demo.Controls
|
||||
{
|
||||
public partial class FPieChart : UITitlePage
|
||||
{
|
||||
public FPieChart()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void uiImageButton1_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
PieChart.ChartStyleType = UIChartStyleType.Default;
|
||||
}
|
||||
|
||||
private void uiImageButton2_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
PieChart.ChartStyleType = UIChartStyleType.Plain;
|
||||
}
|
||||
|
||||
private void uiImageButton3_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
PieChart.ChartStyleType = UIChartStyleType.Dark;
|
||||
}
|
||||
}
|
||||
}
|
120
SunnyUI.Demo/Charts/FPieChart.resx
Normal file
120
SunnyUI.Demo/Charts/FPieChart.resx
Normal 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>
|
7
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
7
SunnyUI.Demo/Controls/FTextBox.Designer.cs
generated
@ -82,7 +82,7 @@
|
||||
//
|
||||
this.uiTextBox1.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox1.FillColor = System.Drawing.Color.White;
|
||||
this.uiTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTextBox1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox1.Location = new System.Drawing.Point(117, 54);
|
||||
this.uiTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiTextBox1.Maximum = 2147483647D;
|
||||
@ -90,7 +90,6 @@
|
||||
this.uiTextBox1.Name = "uiTextBox1";
|
||||
this.uiTextBox1.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.uiTextBox1.Size = new System.Drawing.Size(221, 29);
|
||||
this.uiTextBox1.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiTextBox1.TabIndex = 3;
|
||||
this.uiTextBox1.Watermark = "水印文字";
|
||||
//
|
||||
@ -219,7 +218,6 @@
|
||||
this.uiRichTextBox1.Name = "uiRichTextBox1";
|
||||
this.uiRichTextBox1.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.uiRichTextBox1.Size = new System.Drawing.Size(308, 226);
|
||||
this.uiRichTextBox1.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiRichTextBox1.TabIndex = 32;
|
||||
this.uiRichTextBox1.Text = "Blog: https://www.cnblogs.com/yhuse\nGitee: https://gitee.com/yhuse/SunnyUI\nGitHub" +
|
||||
": https://github.com/yhuse/SunnyUI\nSunnyUI.Net 系列文章目录\n欢迎交流,QQ群: 56829229 (SunnyU" +
|
||||
@ -251,7 +249,7 @@
|
||||
//
|
||||
this.uiTextBox4.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.uiTextBox4.FillColor = System.Drawing.Color.White;
|
||||
this.uiTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||
this.uiTextBox4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.uiTextBox4.Location = new System.Drawing.Point(30, 219);
|
||||
this.uiTextBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.uiTextBox4.Maximum = 2147483647D;
|
||||
@ -260,7 +258,6 @@
|
||||
this.uiTextBox4.Name = "uiTextBox4";
|
||||
this.uiTextBox4.Padding = new System.Windows.Forms.Padding(5);
|
||||
this.uiTextBox4.Size = new System.Drawing.Size(308, 226);
|
||||
this.uiTextBox4.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiTextBox4.TabIndex = 35;
|
||||
this.uiTextBox4.Text = "Blog: https://www.cnblogs.com/yhuse\r\nGitee: https://gitee.com/yhuse/SunnyUI\r\nGitH" +
|
||||
"ub: https://github.com/yhuse/SunnyUI\r\nSunnyUI.Net 系列文章目录\r\n欢迎交流,QQ群: 56829229 (Su" +
|
||||
|
12
SunnyUI.Demo/FMain.Designer.cs
generated
12
SunnyUI.Demo/FMain.Designer.cs
generated
@ -31,7 +31,8 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("控件");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("窗体");
|
||||
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("主题");
|
||||
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("图表");
|
||||
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("主题");
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FMain));
|
||||
this.uiLogo1 = new Sunny.UI.UILogo();
|
||||
this.uiAvatar = new Sunny.UI.UIAvatar();
|
||||
@ -49,16 +50,20 @@
|
||||
//
|
||||
this.Header.Controls.Add(this.uiAvatar);
|
||||
this.Header.Controls.Add(this.uiLogo1);
|
||||
this.Header.MenuStyle = Sunny.UI.UIMenuStyle.Custom;
|
||||
treeNode1.Name = "节点0";
|
||||
treeNode1.Text = "控件";
|
||||
treeNode2.Name = "节点1";
|
||||
treeNode2.Text = "窗体";
|
||||
treeNode3.Name = "节点2";
|
||||
treeNode3.Text = "主题";
|
||||
treeNode3.Text = "图表";
|
||||
treeNode4.Name = "节点2";
|
||||
treeNode4.Text = "主题";
|
||||
this.Header.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1,
|
||||
treeNode2,
|
||||
treeNode3});
|
||||
treeNode3,
|
||||
treeNode4});
|
||||
this.Header.SelectedIndex = 0;
|
||||
this.Header.Size = new System.Drawing.Size(1024, 110);
|
||||
this.Header.MenuItemClick += new Sunny.UI.UINavBar.OnMenuItemClick(this.Header_MenuItemClick);
|
||||
@ -71,7 +76,6 @@
|
||||
this.uiLogo1.MinimumSize = new System.Drawing.Size(300, 80);
|
||||
this.uiLogo1.Name = "uiLogo1";
|
||||
this.uiLogo1.Size = new System.Drawing.Size(300, 80);
|
||||
this.uiLogo1.Style = Sunny.UI.UIStyle.Custom;
|
||||
this.uiLogo1.TabIndex = 3;
|
||||
this.uiLogo1.Text = "uiLogo1";
|
||||
//
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Sunny.UI.Demo.Forms;
|
||||
using System.Windows.Forms;
|
||||
using Sunny.UI.Demo.Controls;
|
||||
|
||||
namespace Sunny.UI.Demo
|
||||
{
|
||||
@ -40,11 +41,17 @@ namespace Sunny.UI.Demo
|
||||
Aside.CreateChildNode(parent, 61508, 24, AddPage(new FEditor(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, 61674, 24, AddPage(new FFrames(), ++pageIndex));
|
||||
|
||||
Header.SetNodeSymbol(Header.Nodes[2], 61502);
|
||||
pageIndex = 3000;
|
||||
Header.SetNodePageIndex(Header.Nodes[2], pageIndex);
|
||||
Header.SetNodeSymbol(Header.Nodes[2], 61950);
|
||||
parent = Aside.CreateNode("Forms", 61950, 24, pageIndex);
|
||||
Aside.CreateChildNode(parent, 61952, 24, AddPage(new FPieChart(), ++pageIndex));
|
||||
|
||||
Header.SetNodeSymbol(Header.Nodes[3], 61502);
|
||||
var styles = UIStyles.PopularStyles();
|
||||
foreach (UIStyle style in styles)
|
||||
{
|
||||
Header.CreateChildNode(Header.Nodes[2], style.DisplayText(), style.Value());
|
||||
Header.CreateChildNode(Header.Nodes[3], style.DisplayText(), style.Value());
|
||||
}
|
||||
|
||||
Aside.SelectFirst();
|
||||
@ -56,10 +63,11 @@ namespace Sunny.UI.Demo
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
Aside.SelectPage(pageIndex);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
UIStyle style = (UIStyle)pageIndex;
|
||||
StyleManager.Style = style;
|
||||
break;
|
||||
|
30
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
30
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
@ -120,6 +120,36 @@ namespace Sunny.UI.Demo.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ChartDarkStyle {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ChartDarkStyle", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ChartDefaultStyle {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ChartDefaultStyle", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ChartPlainStyle {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ChartPlainStyle", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
@ -136,6 +136,15 @@
|
||||
<data name="AM1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AM1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ChartDarkStyle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ChartDarkStyle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ChartDefaultStyle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ChartDefaultStyle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ChartPlainStyle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ChartPlainStyle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="dashboard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\dashboard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
BIN
SunnyUI.Demo/Resources/ChartDarkStyle.png
Normal file
BIN
SunnyUI.Demo/Resources/ChartDarkStyle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 325 B |
BIN
SunnyUI.Demo/Resources/ChartDefaultStyle.png
Normal file
BIN
SunnyUI.Demo/Resources/ChartDefaultStyle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 439 B |
BIN
SunnyUI.Demo/Resources/ChartPlainStyle.png
Normal file
BIN
SunnyUI.Demo/Resources/ChartPlainStyle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
@ -35,7 +35,8 @@
|
||||
<ApplicationIcon>SunnyUI.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SunnyUI">
|
||||
<Reference Include="SunnyUI, Version=2.2.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Bin\SunnyUI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
@ -87,6 +88,12 @@
|
||||
<Compile Include="Controls\FMeter.Designer.cs">
|
||||
<DependentUpon>FMeter.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Charts\FPieChart.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Charts\FPieChart.Designer.cs">
|
||||
<DependentUpon>FPieChart.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\FTextBox.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@ -278,6 +285,9 @@
|
||||
<EmbeddedResource Include="Controls\FMeter.resx">
|
||||
<DependentUpon>FMeter.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Charts\FPieChart.resx">
|
||||
<DependentUpon>FPieChart.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\FTabControl.resx">
|
||||
<DependentUpon>FTabControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@ -414,6 +424,9 @@
|
||||
<None Include="Resources\HM1.png" />
|
||||
<None Include="Resources\HMF.png" />
|
||||
<None Include="Resources\HMF1.png" />
|
||||
<None Include="Resources\ChartDarkStyle.png" />
|
||||
<None Include="Resources\ChartDefaultStyle.png" />
|
||||
<None Include="Resources\ChartPlainStyle.png" />
|
||||
<Content Include="SunnyUI.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
133
SunnyUI/Charts/UIChart.cs
Normal file
133
SunnyUI/Charts/UIChart.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI.Charts
|
||||
{
|
||||
public class UIChart : UIControl
|
||||
{
|
||||
public UIChart()
|
||||
{
|
||||
ShowText = false;
|
||||
fillColor = UIChartStyles.Plain.BackColor;
|
||||
foreColor = UIChartStyles.Plain.ForeColor;
|
||||
Width = 400;
|
||||
Height = 300;
|
||||
}
|
||||
|
||||
private UIChartStyleType chartStyleType = UIChartStyleType.Plain;
|
||||
|
||||
[DefaultValue(UIChartStyleType.Plain)]
|
||||
public UIChartStyleType ChartStyleType
|
||||
{
|
||||
get => chartStyleType;
|
||||
set
|
||||
{
|
||||
chartStyleType = value;
|
||||
if (Style != UIStyle.Custom)
|
||||
{
|
||||
fillColor = ChartStyle.BackColor;
|
||||
foreColor = ChartStyle.ForeColor;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
[Description("字体颜色")]
|
||||
[Category("自定义")]
|
||||
[DefaultValue(typeof(Color), "White")]
|
||||
public override Color ForeColor
|
||||
{
|
||||
get => foreColor;
|
||||
set => SetForeColor(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
[Description("填充颜色")]
|
||||
[Category("自定义")]
|
||||
[DefaultValue(typeof(Color), "235, 243, 255")]
|
||||
public Color FillColor
|
||||
{
|
||||
get => fillColor;
|
||||
set => SetFillColor(value);
|
||||
}
|
||||
|
||||
protected override void OnPaintFill(Graphics g, GraphicsPath path)
|
||||
{
|
||||
g.FillPath(fillColor, path);
|
||||
}
|
||||
|
||||
private UIOption option;
|
||||
|
||||
[Browsable(false)]
|
||||
public UIOption Option
|
||||
{
|
||||
get => option;
|
||||
set
|
||||
{
|
||||
option = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected UIOption emptyOption;
|
||||
|
||||
protected UIOption EmptyOption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (emptyOption == null)
|
||||
CreateEmptyOption();
|
||||
|
||||
return emptyOption;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
DrawOption(e.Graphics, Option ?? EmptyOption);
|
||||
}
|
||||
|
||||
protected virtual void CreateEmptyOption()
|
||||
{
|
||||
}
|
||||
|
||||
protected UIChartStyle ChartStyle => UIChartStyles.GetChartStyle(ChartStyleType);
|
||||
|
||||
private void DrawOption(Graphics g, UIOption o)
|
||||
{
|
||||
if (o == null) return;
|
||||
if (o.Title != null) DrawTitle(g, o.Title);
|
||||
if (o.Series.Count > 0) DrawSeries(g, o.Series);
|
||||
if (o.Legend != null) DrawLegend(g, o.Legend);
|
||||
}
|
||||
|
||||
protected virtual void DrawTitle(Graphics g, UITitle title)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void DrawSeries(Graphics g, List<UISeries> series)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void DrawLegend(Graphics g, UILegend legend)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
base.SetStyleColor(uiColor);
|
||||
fillColor = ChartStyle.BackColor;
|
||||
foreColor = ChartStyle.ForeColor;
|
||||
}
|
||||
}
|
||||
}
|
226
SunnyUI/Charts/UIOption.cs
Normal file
226
SunnyUI/Charts/UIOption.cs
Normal file
@ -0,0 +1,226 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
public class UIOption : IDisposable
|
||||
{
|
||||
public UITitle Title;
|
||||
|
||||
public List<UISeries> Series = new List<UISeries>();
|
||||
|
||||
public UILegend Legend;
|
||||
|
||||
public void AddSeries(UISeries series)
|
||||
{
|
||||
Series.Add(series);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (var series in Series)
|
||||
{
|
||||
series?.Dispose();
|
||||
}
|
||||
|
||||
Series.Clear();
|
||||
}
|
||||
|
||||
public int SeriesCount => Series.Count;
|
||||
}
|
||||
|
||||
public class UILegend
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class UITitle
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
||||
public string SubText { get; set; }
|
||||
|
||||
public UITextAlignment Left { get; set; }
|
||||
}
|
||||
|
||||
public enum UITextAlignment
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
Right
|
||||
}
|
||||
|
||||
public class UISeries : IDisposable
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public UISeriesType Type { get; set; }
|
||||
|
||||
public int Radius { get; set; } = 50;
|
||||
|
||||
public UICenter Center { get; set; } = new UICenter(50, 50);
|
||||
|
||||
public readonly List<UISeriesData> Data = new List<UISeriesData>();
|
||||
|
||||
public void AddData(string name, double value)
|
||||
{
|
||||
Data.Add(new UISeriesData(name, value));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Data.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class UICenter
|
||||
{
|
||||
public int Left { get; set; }
|
||||
|
||||
public int Top { get; set; }
|
||||
|
||||
public UICenter() : this(50, 50)
|
||||
{
|
||||
}
|
||||
|
||||
public UICenter(int left, int top)
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
}
|
||||
}
|
||||
|
||||
public class UISeriesData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public double Value { get; set; }
|
||||
|
||||
public UISeriesData()
|
||||
{
|
||||
}
|
||||
|
||||
public UISeriesData(string name, double value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum UISeriesType
|
||||
{
|
||||
Pie,
|
||||
Line,
|
||||
Bar
|
||||
}
|
||||
|
||||
public enum UIChartStyleType
|
||||
{
|
||||
Default,
|
||||
Plain,
|
||||
Dark
|
||||
}
|
||||
|
||||
public static class UIChartStyles
|
||||
{
|
||||
public static UIChartStyle Default = new UIDefaultChartStyle();
|
||||
|
||||
public static UIChartStyle Plain = new UILightChartStyle();
|
||||
|
||||
public static UIChartStyle Dark = new UIDarkChartStyle();
|
||||
|
||||
public static UIChartStyle GetChartStyle(UIChartStyleType style)
|
||||
{
|
||||
if (style == UIChartStyleType.Default) return Default;
|
||||
if (style == UIChartStyleType.Dark) return Dark;
|
||||
return Plain;
|
||||
}
|
||||
}
|
||||
|
||||
public class UIChartStyle
|
||||
{
|
||||
public virtual Color BackColor => Color.FromArgb(244, 244, 244);
|
||||
|
||||
public virtual Color ForeColor => Color.FromArgb(54, 54, 54);
|
||||
|
||||
public int ColorCount => 11;
|
||||
|
||||
public virtual Color[] SeriesColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
Color.FromArgb(241,42,38),
|
||||
Color.FromArgb(43,71,85),
|
||||
Color.FromArgb(69,161,168),
|
||||
Color.FromArgb(229,125,96),
|
||||
Color.FromArgb(125,200,175),
|
||||
Color.FromArgb(101,159,132),
|
||||
Color.FromArgb(216,130,27),
|
||||
Color.FromArgb(195,160,152),
|
||||
Color.FromArgb(109,112,115),
|
||||
Color.FromArgb(79,101,112),
|
||||
Color.FromArgb(193,204,211)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UIDefaultChartStyle : UIChartStyle
|
||||
{
|
||||
}
|
||||
|
||||
public class UILightChartStyle : UIChartStyle
|
||||
{
|
||||
public override Color[] SeriesColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
Color.FromArgb(0,163,219),
|
||||
Color.FromArgb(0,199,235),
|
||||
Color.FromArgb(0,227,230),
|
||||
Color.FromArgb(131,232,187),
|
||||
Color.FromArgb(255,217,91),
|
||||
Color.FromArgb(255,153,120),
|
||||
Color.FromArgb(255,104,139),
|
||||
Color.FromArgb(245,89,168),
|
||||
Color.FromArgb(247,139,205),
|
||||
Color.FromArgb(241,185,242),
|
||||
Color.FromArgb(156,149,245)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UIDarkChartStyle : UIChartStyle
|
||||
{
|
||||
public override Color BackColor => Color.FromArgb(54, 54, 54);
|
||||
|
||||
public override Color ForeColor => Color.FromArgb(239, 239, 239);
|
||||
|
||||
public override Color[] SeriesColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
Color.FromArgb(242,99,95),
|
||||
Color.FromArgb(103,154,160),
|
||||
Color.FromArgb(246,152,130),
|
||||
Color.FromArgb(122,194,170),
|
||||
Color.FromArgb(255,119,74),
|
||||
Color.FromArgb(244,220,120),
|
||||
Color.FromArgb(98,163,117),
|
||||
Color.FromArgb(83,186,189),
|
||||
Color.FromArgb(105,137,170),
|
||||
Color.FromArgb(124,203,143),
|
||||
Color.FromArgb(255,154,59)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
156
SunnyUI/Charts/UIPieChart.cs
Normal file
156
SunnyUI/Charts/UIPieChart.cs
Normal file
@ -0,0 +1,156 @@
|
||||
using Sunny.UI.Charts;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sunny.UI
|
||||
{
|
||||
[ToolboxItem(true)]
|
||||
public sealed class UIPieChart : UIChart
|
||||
{
|
||||
protected override void CreateEmptyOption()
|
||||
{
|
||||
if (emptyOption != null) return;
|
||||
|
||||
emptyOption = new UIOption();
|
||||
|
||||
emptyOption.Title = new UITitle();
|
||||
emptyOption.Title.Text = "SunnyUI";
|
||||
emptyOption.Title.SubText = "PieChart";
|
||||
emptyOption.Title.Left = UITextAlignment.Center;
|
||||
|
||||
var series = new UISeries();
|
||||
series.Name = "饼状图";
|
||||
series.Type = UISeriesType.Pie;
|
||||
series.Center = new UICenter(50, 50);
|
||||
series.Radius = 75;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
series.AddData("Data" + i, (i + 1) * 20);
|
||||
}
|
||||
|
||||
emptyOption.Series.Add(series);
|
||||
}
|
||||
|
||||
protected override void DrawTitle(Graphics g, UITitle title)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DrawSeries(Graphics g, List<UISeries> series)
|
||||
{
|
||||
if (series == null || series.Count == 0) return;
|
||||
|
||||
for (int pieIndex = 0; pieIndex < series.Count; pieIndex++)
|
||||
{
|
||||
var pie = series[pieIndex];
|
||||
if (!Angles.ContainsKey(pieIndex))
|
||||
{
|
||||
Angles.TryAdd(pieIndex, new ConcurrentDictionary<int, Angle>());
|
||||
}
|
||||
|
||||
RectangleF rect = GetSeriesRect(pie);
|
||||
double all = 0;
|
||||
foreach (var data in pie.Data)
|
||||
{
|
||||
all += data.Value;
|
||||
}
|
||||
|
||||
if (all.IsZero()) return;
|
||||
float start = 0;
|
||||
for (int i = 0; i < pie.Data.Count; i++)
|
||||
{
|
||||
float angle = (float)(pie.Data[i].Value * 360.0f / all);
|
||||
Angles[pieIndex].AddOrUpdate(i, new Angle(start, angle));
|
||||
start += angle;
|
||||
}
|
||||
|
||||
for (int i = 0; i < pie.Data.Count; i++)
|
||||
{
|
||||
Color color = ChartStyle.SeriesColor[i % ChartStyle.ColorCount];
|
||||
RectangleF rectx = new RectangleF(rect.X - 10, rect.Y - 10, rect.Width + 20, rect.Width + 20);
|
||||
g.FillPie(color, ActiveIndex == i ? rectx : rect, Angles[pieIndex][i].Start - 90, Angles[pieIndex][i].Sweep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>> Angles = new ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>>();
|
||||
|
||||
protected override void DrawLegend(Graphics g, UILegend legend)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
UIOption option = Option ?? EmptyOption;
|
||||
|
||||
int index = -1;
|
||||
for (int pieIndex = 0; pieIndex < option.SeriesCount; pieIndex++)
|
||||
{
|
||||
RectangleF rect = GetSeriesRect(option.Series[pieIndex]);
|
||||
if (!e.Location.InRect(rect)) continue;
|
||||
|
||||
PointF pf = new PointF( rect.Left +rect.Width/2.0f,rect.Top +rect.Height/2.0f);
|
||||
if (MathEx.CalcDistance(e.Location, pf) * 2 > rect.Width) continue;
|
||||
|
||||
double az =MathEx.CalcAngle(e.Location,pf);
|
||||
for (int azIndex = 0; azIndex < option.Series[pieIndex].Data.Count; azIndex++)
|
||||
{
|
||||
if (az >= Angles[pieIndex][azIndex].Start && az <= Angles[pieIndex][azIndex].Start + Angles[pieIndex][azIndex].Sweep)
|
||||
{
|
||||
index = azIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ActiveIndex = index;
|
||||
}
|
||||
|
||||
public double Rad(double d)
|
||||
{
|
||||
return d * Math.PI / 180.0;
|
||||
}
|
||||
|
||||
private int activeIndex = -1;
|
||||
|
||||
[Browsable(false)]
|
||||
private int ActiveIndex
|
||||
{
|
||||
get => activeIndex;
|
||||
set
|
||||
{
|
||||
if (activeIndex != value)
|
||||
{
|
||||
activeIndex = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private RectangleF GetSeriesRect(UISeries series)
|
||||
{
|
||||
int left = series.Center.Left;
|
||||
int top = series.Center.Top;
|
||||
left = Width * left / 100;
|
||||
top = Height * top / 100;
|
||||
float halfRadius = Math.Min(Width, Height) * series.Radius / 200.0f;
|
||||
return new RectangleF(left - halfRadius, top - halfRadius, halfRadius * 2, halfRadius * 2);
|
||||
}
|
||||
|
||||
public struct Angle
|
||||
{
|
||||
public float Start { get; set; }
|
||||
public float Sweep { get; set; }
|
||||
|
||||
public Angle(float start, float sweep)
|
||||
{
|
||||
Start = start;
|
||||
Sweep = sweep;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -520,7 +520,7 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
CheckMaxMin();
|
||||
Invalidate();
|
||||
//Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
@ -202,21 +202,21 @@ namespace Sunny.UI
|
||||
private void OnMouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
if (bar.Visible)
|
||||
if (bar!=null && bar.Visible && edit!=null)
|
||||
{
|
||||
var si = ScrollBarInfo.GetInfo(Handle);
|
||||
var si = ScrollBarInfo.GetInfo(edit.Handle);
|
||||
if (e.Delta > 10)
|
||||
{
|
||||
if (si.nPos > 0)
|
||||
{
|
||||
ScrollBarInfo.ScrollUp(Handle);
|
||||
ScrollBarInfo.ScrollUp(edit.Handle);
|
||||
}
|
||||
}
|
||||
else if (e.Delta < -10)
|
||||
{
|
||||
if (si.nPos < si.ScrollMax)
|
||||
{
|
||||
ScrollBarInfo.ScrollDown(Handle);
|
||||
ScrollBarInfo.ScrollDown(edit.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,11 +41,14 @@ namespace Sunny.UI
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
CalcEditHeight();
|
||||
Height = MiniHeight;
|
||||
ShowText = false;
|
||||
Font = UIFontColor.Font;
|
||||
|
||||
edit.Left = 3;
|
||||
edit.Top = 3;
|
||||
edit.Top = (Height - edit.Height) / 2;
|
||||
edit.Left = 4;
|
||||
edit.Width = Width - 8;
|
||||
edit.Text = String.Empty;
|
||||
edit.BorderStyle = BorderStyle.None;
|
||||
edit.TextChanged += EditTextChanged;
|
||||
@ -66,6 +69,8 @@ namespace Sunny.UI
|
||||
bar.ValueChanged += Bar_ValueChanged;
|
||||
edit.MouseWheel += OnMouseWheel;
|
||||
bar.MouseEnter += Bar_MouseEnter;
|
||||
|
||||
SizeChange();
|
||||
}
|
||||
|
||||
private void Bar_MouseEnter(object sender, EventArgs e)
|
||||
@ -81,21 +86,21 @@ namespace Sunny.UI
|
||||
private void OnMouseWheel(object sender, MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
if (bar.Visible)
|
||||
if (bar!=null && bar.Visible && edit!=null)
|
||||
{
|
||||
var si = ScrollBarInfo.GetInfo(Handle);
|
||||
var si = ScrollBarInfo.GetInfo(edit.Handle);
|
||||
if (e.Delta > 10)
|
||||
{
|
||||
if (si.nPos > 0)
|
||||
{
|
||||
ScrollBarInfo.ScrollUp(Handle);
|
||||
ScrollBarInfo.ScrollUp(edit.Handle);
|
||||
}
|
||||
}
|
||||
else if (e.Delta < -10)
|
||||
{
|
||||
if (si.nPos < si.ScrollMax)
|
||||
{
|
||||
ScrollBarInfo.ScrollDown(Handle);
|
||||
ScrollBarInfo.ScrollDown(edit.Handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -197,12 +202,9 @@ namespace Sunny.UI
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
edit.Font = Font;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaintFore(Graphics g, GraphicsPath path)
|
||||
{
|
||||
CalcEditHeight();
|
||||
SizeChange();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
@ -221,38 +223,43 @@ namespace Sunny.UI
|
||||
if (si.ScrollMax > 0)
|
||||
{
|
||||
bar.Maximum = si.ScrollMax;
|
||||
//bar.Visible = si.ScrollMax > 0 && si.nMax > 0 && si.nPage > 0;
|
||||
bar.Value = si.nPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
bar.Maximum = si.ScrollMax;
|
||||
//bar.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private int MiniHeight;
|
||||
|
||||
private void SizeChange()
|
||||
private void CalcEditHeight()
|
||||
{
|
||||
UIEdit edt = new UIEdit();
|
||||
edt.Font = edit.Font;
|
||||
edt.Invalidate();
|
||||
MiniHeight = edt.Height;
|
||||
edt.Dispose();
|
||||
}
|
||||
|
||||
private void SizeChange()
|
||||
{
|
||||
if (!multiline)
|
||||
{
|
||||
Height = MiniHeight;
|
||||
if (Height != MiniHeight)
|
||||
{
|
||||
Height = MiniHeight;
|
||||
}
|
||||
|
||||
edit.Top = (Height - edit.Height) / 2;
|
||||
edit.Left = 4;
|
||||
edit.Width = Width - 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Height < MiniHeight)
|
||||
if (Height < 69)
|
||||
{
|
||||
Height = MiniHeight;
|
||||
Height = 69;
|
||||
}
|
||||
|
||||
edit.Top = 3;
|
||||
|
@ -484,6 +484,70 @@ namespace Sunny.UI
|
||||
path.Dispose();
|
||||
}
|
||||
|
||||
public static void FillPie(this Graphics g, Color color, int x, int y, int width, int height, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.Smooth(smooth);
|
||||
using (Brush br = new SolidBrush(color))
|
||||
{
|
||||
g.FillPie(br, x, y, width, height, startAngle, sweepAngle);
|
||||
}
|
||||
|
||||
g.Smooth(false);
|
||||
}
|
||||
|
||||
public static void FillPie(this Graphics g, Color color, Rectangle rect, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.FillPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
|
||||
}
|
||||
|
||||
public static void FillPie(this Graphics g, Color color, float x, float y, float width, float height, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.Smooth(smooth);
|
||||
using (Brush br = new SolidBrush(color))
|
||||
{
|
||||
g.FillPie(br, x, y, width, height, startAngle, sweepAngle);
|
||||
}
|
||||
|
||||
g.Smooth(false);
|
||||
}
|
||||
|
||||
public static void FillPie(this Graphics g, Color color, RectangleF rect, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.FillPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
|
||||
}
|
||||
|
||||
public static void DrawPie(this Graphics g, Color color, int x, int y, int width, int height, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.Smooth(smooth);
|
||||
using (Pen pen = new Pen(color))
|
||||
{
|
||||
g.DrawPie(pen, x, y, width, height, startAngle, sweepAngle);
|
||||
}
|
||||
|
||||
g.Smooth(false);
|
||||
}
|
||||
|
||||
public static void DrawPie(this Graphics g, Color color, Rectangle rect, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.DrawPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
|
||||
}
|
||||
|
||||
public static void DrawPie(this Graphics g, Color color, float x, float y, float width, float height, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.Smooth(smooth);
|
||||
using (Pen pen = new Pen(color))
|
||||
{
|
||||
g.DrawPie(pen, x, y, width, height, startAngle, sweepAngle);
|
||||
}
|
||||
|
||||
g.Smooth(false);
|
||||
}
|
||||
|
||||
public static void DrawPie(this Graphics g, Color color, RectangleF rect, float startAngle, float sweepAngle, bool smooth = true)
|
||||
{
|
||||
g.DrawPie(color, rect.Left, rect.Top, rect.Width, rect.Height, startAngle, sweepAngle, smooth);
|
||||
}
|
||||
|
||||
public static GraphicsPath CreateRoundedRectanglePath(this Rectangle rect, int radius, bool cornerLeftTop = true, bool cornerRightTop = true, bool cornerRightBottom = true, bool cornerLeftBottom = true)
|
||||
{
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
|
@ -32,6 +32,34 @@ namespace Sunny.UI
|
||||
/// </summary>
|
||||
public static class MathEx
|
||||
{
|
||||
public static double CalcDistance(PointF pt1, PointF pt2)
|
||||
{
|
||||
float xx = pt1.X - pt2.X;
|
||||
float yy = pt1.Y - pt2.Y;
|
||||
return Math.Sqrt(xx * xx + yy * yy);
|
||||
}
|
||||
|
||||
public static double CalcDistance(Point pt1, Point pt2)
|
||||
{
|
||||
int xx = pt1.X - pt2.X;
|
||||
int yy = pt1.Y - pt2.Y;
|
||||
return Math.Sqrt(xx * xx + yy * yy);
|
||||
}
|
||||
|
||||
public static double CalcAngle(Point thisPoint,Point toPoint)
|
||||
{
|
||||
double az = Math.Atan2(thisPoint.Y - toPoint.Y, thisPoint.X - toPoint.X) * 180 / Math.PI;
|
||||
az = (az - 270 + 720) % 360;
|
||||
return az;
|
||||
}
|
||||
|
||||
public static double CalcAngle(PointF thisPoint, PointF toPoint)
|
||||
{
|
||||
double az = Math.Atan2(thisPoint.Y - toPoint.Y, thisPoint.X - toPoint.X) * 180 / Math.PI;
|
||||
az = (az - 270 + 720) % 360;
|
||||
return az;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二分查找与最近值序号
|
||||
/// </summary>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Charts\UIChart.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Charts\UIOption.cs" />
|
||||
<Compile Include="Controls\Color\UIColorBar.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@ -97,6 +101,9 @@
|
||||
<Compile Include="Controls\UIDatetimePicker.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Charts\UIPieChart.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\UIRichTextBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -612,6 +619,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="Resources\colorbarIndicators.bmp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -1,6 +1,10 @@
|
||||
+ 增加; - 删除; * 修改
|
||||
|
||||
2020.06.04
|
||||
2020.06.06
|
||||
+ UIPieChart:新增
|
||||
* UITextBox:修复设置为MultiLine时刷新问题
|
||||
|
||||
2020.06.05
|
||||
+ UIRichTextBox:新增
|
||||
* UITextBox:完善TextBox的基本方法和函数
|
||||
* UIForm,UIPage:更改新建窗体时主题未设置的问题
|
||||
|
Loading…
x
Reference in New Issue
Block a user