Compare commits
69 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
42a042beb3 | ||
![]() |
123427892e | ||
![]() |
0b7f218b3c | ||
![]() |
c5e5a11188 | ||
![]() |
8bf338e488 | ||
![]() |
0d989a75ea | ||
![]() |
00897c5cc5 | ||
![]() |
cd04f9cf19 | ||
![]() |
7fd73a8808 | ||
![]() |
b9c87e15e8 | ||
![]() |
4f75336ed5 | ||
![]() |
8fce03fff2 | ||
![]() |
42c453820c | ||
![]() |
dc503f0eea | ||
![]() |
76426019e3 | ||
![]() |
f40426c113 | ||
![]() |
28a1f1a451 | ||
![]() |
ec00734884 | ||
![]() |
282c1ae17c | ||
![]() |
76910ac4ff | ||
![]() |
a07043ae07 | ||
![]() |
8decdf00cf | ||
![]() |
c451a61a66 | ||
![]() |
2c3022a322 | ||
![]() |
b0093af77a | ||
![]() |
8727038717 | ||
![]() |
b9daa7e005 | ||
![]() |
031be368e4 | ||
![]() |
6a5d7bea2f | ||
![]() |
8a5f6ea7b0 | ||
![]() |
36b7d41336 | ||
![]() |
66fec152d4 | ||
![]() |
1d60a09987 | ||
![]() |
6b5d644bd9 | ||
![]() |
b01e4e14e1 | ||
![]() |
5d9e0a6f53 | ||
![]() |
65a35f5bad | ||
![]() |
c0c3298fd1 | ||
![]() |
2c70e734c4 | ||
![]() |
d0c731fe97 | ||
![]() |
09ba37daa3 | ||
![]() |
000c567255 | ||
![]() |
beb21ebb91 | ||
![]() |
452e9e6e15 | ||
![]() |
120dbf2151 | ||
![]() |
98d280d9f0 | ||
![]() |
f831a92cf7 | ||
![]() |
661b44090c | ||
![]() |
741d10939a | ||
![]() |
22677c9974 | ||
![]() |
9dbc2e80bd | ||
![]() |
28cc5b3823 | ||
![]() |
c6650b3c0e | ||
![]() |
1708d57ef1 | ||
![]() |
7e6ee8e98b | ||
![]() |
3c2ba689eb | ||
![]() |
4760de7dd1 | ||
![]() |
c676e92fda | ||
![]() |
92607169d5 | ||
![]() |
e4c483dfeb | ||
![]() |
af41257d35 | ||
![]() |
76b13321e6 | ||
![]() |
63952daa11 | ||
![]() |
b68740f828 | ||
![]() |
45d2eed8b9 | ||
![]() |
ecc5d49b90 | ||
![]() |
88bce81140 | ||
![]() |
2d98153089 | ||
![]() |
49c9419590 |
@ -23,11 +23,11 @@ SunnyUI.Net项目已加入[dotNET China](https://gitee.com/dotnetchina) 组织
|
|||||||

|

|
||||||
|
|
||||||
#### 软件介绍
|
#### 软件介绍
|
||||||
- SunnyUI.NET 是基于.Net Framework4.0+、.Net6、.Net8 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。
|
- SunnyUI.NET 是基于.Net Framework4.0+、.Net8、.Net9 框架的 C# WinForm 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
- 源码编译环境:
|
- 源码编译环境:
|
||||||
1. **VS2022**,安装.NetFramework4.0目标包的方法见:https://www.cnblogs.com/yhuse/p/15536393.html
|
1. **VS2022**,安装.NetFramework4.0目标包的方法见:https://www.cnblogs.com/yhuse/p/15536393.html
|
||||||
2. 编译源码,.Net8需要VS2022 17.8+版本,或者修改SunnyUI.csproj文件的TargetFrameworks属性以适应VS环境
|
2. 编译源码,.Net8需要VS2022 17.12+版本,或者修改SunnyUI.csproj文件的TargetFrameworks属性以适应VS环境
|
||||||
- 动态库应用环境: **VS2010**及以上均可,支持.Net Framework4.0+、.Net6、.Net8
|
- 动态库应用环境: **VS2010**及以上均可,支持.Net Framework4.0+、.Net8、.Net9
|
||||||
1. 推荐通过Nuget安装:Install-Package SunnyUI,或者通过Nuget搜索SunnyUI安装。
|
1. 推荐通过Nuget安装:Install-Package SunnyUI,或者通过Nuget搜索SunnyUI安装。
|
||||||
2. 不支持(.Net Framework 4 **Client Profile**)。
|
2. 不支持(.Net Framework 4 **Client Profile**)。
|
||||||
|
|
||||||
|
72
SunnyUI.Demo/Controls/FButton.Designer.cs
generated
72
SunnyUI.Demo/Controls/FButton.Designer.cs
generated
@ -84,10 +84,17 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiToolTip1 = new Sunny.UI.UIToolTip(this.components);
|
this.uiToolTip1 = new Sunny.UI.UIToolTip(this.components);
|
||||||
this.uiSwitch5 = new Sunny.UI.UISwitch();
|
this.uiSwitch5 = new Sunny.UI.UISwitch();
|
||||||
this.uiSwitch6 = new Sunny.UI.UISwitch();
|
this.uiSwitch6 = new Sunny.UI.UISwitch();
|
||||||
|
this.uiMenuButton1 = new Sunny.UI.UIMenuButton();
|
||||||
|
this.uiLine6 = new Sunny.UI.UILine();
|
||||||
|
this.uiContextMenuStrip1 = new Sunny.UI.UIContextMenuStrip();
|
||||||
|
this.菜单一ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.菜单二ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.菜单三ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.uiImageButton4)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.uiImageButton4)).BeginInit();
|
||||||
((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.uiContextMenuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// uiSwitch3
|
// uiSwitch3
|
||||||
@ -1004,11 +1011,69 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiSwitch6.TabIndex = 117;
|
this.uiSwitch6.TabIndex = 117;
|
||||||
this.uiSwitch6.Text = "uiSwitch6";
|
this.uiSwitch6.Text = "uiSwitch6";
|
||||||
//
|
//
|
||||||
|
// uiMenuButton1
|
||||||
|
//
|
||||||
|
this.uiMenuButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.uiMenuButton1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiMenuButton1.Location = new System.Drawing.Point(30, 554);
|
||||||
|
this.uiMenuButton1.Menu = this.uiContextMenuStrip1;
|
||||||
|
this.uiMenuButton1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
|
this.uiMenuButton1.Name = "uiMenuButton1";
|
||||||
|
this.uiMenuButton1.Size = new System.Drawing.Size(180, 35);
|
||||||
|
this.uiMenuButton1.Symbol = 361642;
|
||||||
|
this.uiMenuButton1.TabIndex = 118;
|
||||||
|
this.uiMenuButton1.Text = "下拉菜单按钮";
|
||||||
|
this.uiMenuButton1.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
//
|
||||||
|
// uiLine6
|
||||||
|
//
|
||||||
|
this.uiLine6.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.uiLine6.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLine6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
|
this.uiLine6.Location = new System.Drawing.Point(30, 516);
|
||||||
|
this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16);
|
||||||
|
this.uiLine6.Name = "uiLine6";
|
||||||
|
this.uiLine6.Size = new System.Drawing.Size(312, 20);
|
||||||
|
this.uiLine6.TabIndex = 119;
|
||||||
|
this.uiLine6.Text = "UIMenuButton";
|
||||||
|
this.uiLine6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// uiContextMenuStrip1
|
||||||
|
//
|
||||||
|
this.uiContextMenuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(249)))), ((int)(((byte)(255)))));
|
||||||
|
this.uiContextMenuStrip1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.菜单一ToolStripMenuItem,
|
||||||
|
this.菜单二ToolStripMenuItem,
|
||||||
|
this.菜单三ToolStripMenuItem});
|
||||||
|
this.uiContextMenuStrip1.Name = "uiContextMenuStrip1";
|
||||||
|
this.uiContextMenuStrip1.Size = new System.Drawing.Size(123, 70);
|
||||||
|
//
|
||||||
|
// 菜单一ToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.菜单一ToolStripMenuItem.Name = "菜单一ToolStripMenuItem";
|
||||||
|
this.菜单一ToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.菜单一ToolStripMenuItem.Text = "菜单一";
|
||||||
|
//
|
||||||
|
// 菜单二ToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.菜单二ToolStripMenuItem.Name = "菜单二ToolStripMenuItem";
|
||||||
|
this.菜单二ToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.菜单二ToolStripMenuItem.Text = "菜单二";
|
||||||
|
//
|
||||||
|
// 菜单三ToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.菜单三ToolStripMenuItem.Name = "菜单三ToolStripMenuItem";
|
||||||
|
this.菜单三ToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||||
|
this.菜单三ToolStripMenuItem.Text = "菜单三";
|
||||||
|
//
|
||||||
// FButton
|
// FButton
|
||||||
//
|
//
|
||||||
this.AllowShowTitle = true;
|
this.AllowShowTitle = true;
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 614);
|
this.ClientSize = new System.Drawing.Size(800, 614);
|
||||||
|
this.Controls.Add(this.uiLine6);
|
||||||
|
this.Controls.Add(this.uiMenuButton1);
|
||||||
this.Controls.Add(this.uiSymbolButton24);
|
this.Controls.Add(this.uiSymbolButton24);
|
||||||
this.Controls.Add(this.uiSwitch6);
|
this.Controls.Add(this.uiSwitch6);
|
||||||
this.Controls.Add(this.uiSwitch5);
|
this.Controls.Add(this.uiSwitch5);
|
||||||
@ -1072,6 +1137,7 @@ namespace Sunny.UI.Demo
|
|||||||
((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();
|
||||||
|
this.uiContextMenuStrip1.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1132,5 +1198,11 @@ namespace Sunny.UI.Demo
|
|||||||
private UIToolTip uiToolTip1;
|
private UIToolTip uiToolTip1;
|
||||||
private UISwitch uiSwitch5;
|
private UISwitch uiSwitch5;
|
||||||
private UISwitch uiSwitch6;
|
private UISwitch uiSwitch6;
|
||||||
|
private UIMenuButton uiMenuButton1;
|
||||||
|
private UILine uiLine6;
|
||||||
|
private UIContextMenuStrip uiContextMenuStrip1;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem 菜单一ToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem 菜单二ToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem 菜单三ToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -120,4 +120,7 @@
|
|||||||
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="uiToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="uiContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>133, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -40,8 +40,6 @@ namespace Sunny.UI.Demo
|
|||||||
uiComboDataGridView1.DataGridView.AddColumn("数据列2", "Column2");
|
uiComboDataGridView1.DataGridView.AddColumn("数据列2", "Column2");
|
||||||
uiComboDataGridView1.DataGridView.AddColumn("数据列3", "Column3");
|
uiComboDataGridView1.DataGridView.AddColumn("数据列3", "Column3");
|
||||||
uiComboDataGridView1.DataGridView.ReadOnly = true;
|
uiComboDataGridView1.DataGridView.ReadOnly = true;
|
||||||
uiComboDataGridView1.SelectIndexChange += UiComboDataGridView1_SelectIndexChange;
|
|
||||||
uiComboDataGridView1.ShowFilter = true;
|
|
||||||
uiComboDataGridView1.DataGridView.DataSource = dt;//用DataTable做数据源过滤,用List不行
|
uiComboDataGridView1.DataGridView.DataSource = dt;//用DataTable做数据源过滤,用List不行
|
||||||
uiComboDataGridView1.FilterColumnName = "Column1;Column3"; //不设置则全部列过滤,可加分号过滤多列
|
uiComboDataGridView1.FilterColumnName = "Column1;Column3"; //不设置则全部列过滤,可加分号过滤多列
|
||||||
|
|
||||||
@ -52,7 +50,6 @@ namespace Sunny.UI.Demo
|
|||||||
uiComboDataGridView2.DataGridView.AddColumn("数据列2", "Column2");
|
uiComboDataGridView2.DataGridView.AddColumn("数据列2", "Column2");
|
||||||
uiComboDataGridView2.DataGridView.AddColumn("数据列3", "Column3");
|
uiComboDataGridView2.DataGridView.AddColumn("数据列3", "Column3");
|
||||||
uiComboDataGridView2.DataGridView.ReadOnly = true;
|
uiComboDataGridView2.DataGridView.ReadOnly = true;
|
||||||
uiComboDataGridView2.ShowFilter = true;
|
|
||||||
uiComboDataGridView2.DataGridView.DataSource = dt;
|
uiComboDataGridView2.DataGridView.DataSource = dt;
|
||||||
uiComboDataGridView2.FilterColumnName = "Column1"; //不设置则全部列过滤
|
uiComboDataGridView2.FilterColumnName = "Column1"; //不设置则全部列过滤
|
||||||
|
|
||||||
@ -152,7 +149,7 @@ namespace Sunny.UI.Demo
|
|||||||
if (value != null && value is DataGridViewSelectedRowCollection)
|
if (value != null && value is DataGridViewSelectedRowCollection)
|
||||||
{
|
{
|
||||||
DataGridViewSelectedRowCollection collection = (DataGridViewSelectedRowCollection)value;
|
DataGridViewSelectedRowCollection collection = (DataGridViewSelectedRowCollection)value;
|
||||||
foreach (var item in collection)
|
foreach (object item in collection)
|
||||||
{
|
{
|
||||||
DataGridViewRow row = (DataGridViewRow)item;
|
DataGridViewRow row = (DataGridViewRow)item;
|
||||||
uiComboDataGridView2.Text += row.Cells[0].Value.ToString();//通过索引显示值
|
uiComboDataGridView2.Text += row.Cells[0].Value.ToString();//通过索引显示值
|
||||||
|
@ -12,7 +12,7 @@ namespace Sunny.UI.Demo
|
|||||||
var styles = UIStyles.PopularStyles();
|
var styles = UIStyles.PopularStyles();
|
||||||
foreach (UIStyle style in styles)
|
foreach (UIStyle style in styles)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem item = new ToolStripMenuItem(style.DisplayText()) { Tag = style };
|
ToolStripMenuItem item = new ToolStripMenuItem(style.Description()) { Tag = style };
|
||||||
item.Click += Item_Click;
|
item.Click += Item_Click;
|
||||||
uiContextMenuStrip1.Items.Add(item);
|
uiContextMenuStrip1.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ using System.Windows.Forms;
|
|||||||
namespace Sunny.UI.Demo
|
namespace Sunny.UI.Demo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Windows10、Windows11 建议用UIForm2,更接近原生窗体使用体验,用UIForm也可以
|
/// WindowsXP、Windows7、Windows10、Windows11 建议使用 UIForm
|
||||||
/// WindowsXP、Windows7 建议使用UIForm
|
/// Windows10、Windows11 可尝试使用 UIForm2,更接近原生窗体使用体验,用 UIForm 也可以
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FMain : UIForm2
|
public partial class FMain : UIForm
|
||||||
{
|
{
|
||||||
public FMain()
|
public FMain()
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ namespace Sunny.UI.Demo
|
|||||||
var styles = UIStyles.PopularStyles();
|
var styles = UIStyles.PopularStyles();
|
||||||
foreach (UIStyle style in styles)
|
foreach (UIStyle style in styles)
|
||||||
{
|
{
|
||||||
uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], style.DisplayText(), style.Value());
|
uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], style.Description(), style.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
var node = uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], "字体图标", 99999);
|
var node = uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], "字体图标", 99999);
|
||||||
@ -105,17 +105,17 @@ namespace Sunny.UI.Demo
|
|||||||
node = uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], "多彩主题", UIStyle.Colorful.Value());
|
node = uiNavBar1.CreateChildNode(uiNavBar1.Nodes[4], "多彩主题", UIStyle.Colorful.Value());
|
||||||
uiNavBar1.SetNodeSymbol(node, 558295);
|
uiNavBar1.SetNodeSymbol(node, 558295);
|
||||||
//左侧导航主节点关联页面
|
//左侧导航主节点关联页面
|
||||||
uiNavMenu1.CreateNode(AddPage(new FSymbols()));
|
uiNavMenu1.CreateNode(AddPage(new FSymbols(), 99999));
|
||||||
uiNavMenu1.CreateNode(AddPage(new FColorful()));
|
uiNavMenu1.CreateNode(AddPage(new FColorful(), UIStyle.Colorful.Value()));
|
||||||
|
|
||||||
//直接增加一个页面,不在左侧列表显示
|
//直接增加一个页面,不在左侧列表显示
|
||||||
//AddPage(new FColorful());
|
|
||||||
AddPage(new FCommon());
|
AddPage(new FCommon());
|
||||||
|
|
||||||
//选中第一个节点
|
//选中第一个节点
|
||||||
uiNavMenu1.SelectPage(1002);
|
uiNavMenu1.SelectPage(1002);
|
||||||
|
|
||||||
uiPanel2.Text = Text = Version;
|
uiPanel2.Text = Text = Version;
|
||||||
|
//设置全局热键
|
||||||
RegisterHotKey(UI.ModifierKeys.Shift, Keys.F8);
|
RegisterHotKey(UI.ModifierKeys.Shift, Keys.F8);
|
||||||
|
|
||||||
//根据页面类型获取页面
|
//根据页面类型获取页面
|
||||||
@ -177,6 +177,11 @@ namespace Sunny.UI.Demo
|
|||||||
Process.Start("https://gitee.com/yhuse/SunnyUI");
|
Process.Start("https://gitee.com/yhuse/SunnyUI");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全局热键事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void Form1_HotKeyEventHandler(object sender, HotKeyEventArgs e)
|
private void Form1_HotKeyEventHandler(object sender, HotKeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.hotKey.ModifierKey == UI.ModifierKeys.Shift && e.hotKey.Key == Keys.F8)
|
if (e.hotKey.ModifierKey == UI.ModifierKeys.Shift && e.hotKey.Key == Keys.F8)
|
||||||
@ -228,8 +233,8 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiNavMenu1.Nodes[2].Text = this.uiNavBar1.Nodes[2].Text = CodeTranslator.Current.Charts;
|
this.uiNavMenu1.Nodes[2].Text = this.uiNavBar1.Nodes[2].Text = CodeTranslator.Current.Charts;
|
||||||
this.uiNavMenu1.Nodes[3].Text = this.uiNavBar1.Nodes[3].Text = CodeTranslator.Current.Industrial;
|
this.uiNavMenu1.Nodes[3].Text = this.uiNavBar1.Nodes[3].Text = CodeTranslator.Current.Industrial;
|
||||||
this.uiNavBar1.Nodes[4].Text = CodeTranslator.Current.Theme;
|
this.uiNavBar1.Nodes[4].Text = CodeTranslator.Current.Theme;
|
||||||
this.uiNavMenu1.Nodes[4].Text = CodeTranslator.Current.Colorful;
|
this.uiNavMenu1.Nodes[4].Text = CodeTranslator.Current.Symbols;
|
||||||
this.uiNavMenu1.Nodes[5].Text = CodeTranslator.Current.Symbols;
|
this.uiNavMenu1.Nodes[5].Text = CodeTranslator.Current.Colorful;
|
||||||
|
|
||||||
this.uiNavBar1.Invalidate();
|
this.uiNavBar1.Invalidate();
|
||||||
this.uiNavMenu1.Invalidate();
|
this.uiNavMenu1.Invalidate();
|
||||||
|
14
SunnyUI.Demo/Forms/FColorful.Designer.cs
generated
14
SunnyUI.Demo/Forms/FColorful.Designer.cs
generated
@ -235,6 +235,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiLabel1
|
// uiLabel1
|
||||||
//
|
//
|
||||||
this.uiLabel1.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLabel1.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLabel1.Location = new System.Drawing.Point(30, 288);
|
this.uiLabel1.Location = new System.Drawing.Point(30, 288);
|
||||||
this.uiLabel1.Name = "uiLabel1";
|
this.uiLabel1.Name = "uiLabel1";
|
||||||
this.uiLabel1.Size = new System.Drawing.Size(698, 23);
|
this.uiLabel1.Size = new System.Drawing.Size(698, 23);
|
||||||
@ -263,6 +264,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiLabel2
|
// uiLabel2
|
||||||
//
|
//
|
||||||
this.uiLabel2.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLabel2.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLabel2.Location = new System.Drawing.Point(176, 383);
|
this.uiLabel2.Location = new System.Drawing.Point(176, 383);
|
||||||
this.uiLabel2.Name = "uiLabel2";
|
this.uiLabel2.Name = "uiLabel2";
|
||||||
this.uiLabel2.Size = new System.Drawing.Size(172, 23);
|
this.uiLabel2.Size = new System.Drawing.Size(172, 23);
|
||||||
@ -272,7 +274,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiLine1
|
// uiLine1
|
||||||
//
|
//
|
||||||
|
this.uiLine1.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLine1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
this.uiLine1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiLine1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLine1.Location = new System.Drawing.Point(30, 430);
|
this.uiLine1.Location = new System.Drawing.Point(30, 430);
|
||||||
this.uiLine1.MinimumSize = new System.Drawing.Size(1, 1);
|
this.uiLine1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.uiLine1.Name = "uiLine1";
|
this.uiLine1.Name = "uiLine1";
|
||||||
@ -283,7 +287,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiLine2
|
// uiLine2
|
||||||
//
|
//
|
||||||
|
this.uiLine2.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLine2.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLine2.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLine2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLine2.Location = new System.Drawing.Point(30, 55);
|
this.uiLine2.Location = new System.Drawing.Point(30, 55);
|
||||||
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
||||||
this.uiLine2.Name = "uiLine2";
|
this.uiLine2.Name = "uiLine2";
|
||||||
@ -298,12 +304,15 @@ namespace Sunny.UI.Demo
|
|||||||
this.cbFont.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
this.cbFont.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
||||||
this.cbFont.FillColor = System.Drawing.Color.White;
|
this.cbFont.FillColor = System.Drawing.Color.White;
|
||||||
this.cbFont.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
this.cbFont.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.cbFont.ItemHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(200)))), ((int)(((byte)(255)))));
|
||||||
|
this.cbFont.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
||||||
this.cbFont.Location = new System.Drawing.Point(101, 473);
|
this.cbFont.Location = new System.Drawing.Point(101, 473);
|
||||||
this.cbFont.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.cbFont.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.cbFont.MinimumSize = new System.Drawing.Size(63, 0);
|
this.cbFont.MinimumSize = new System.Drawing.Size(63, 0);
|
||||||
this.cbFont.Name = "cbFont";
|
this.cbFont.Name = "cbFont";
|
||||||
this.cbFont.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
|
this.cbFont.Padding = new System.Windows.Forms.Padding(0, 0, 30, 2);
|
||||||
this.cbFont.Size = new System.Drawing.Size(469, 29);
|
this.cbFont.Size = new System.Drawing.Size(469, 29);
|
||||||
|
this.cbFont.SymbolSize = 24;
|
||||||
this.cbFont.TabIndex = 79;
|
this.cbFont.TabIndex = 79;
|
||||||
this.cbFont.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
this.cbFont.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
this.cbFont.Watermark = "";
|
this.cbFont.Watermark = "";
|
||||||
@ -311,6 +320,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiLabel3
|
// uiLabel3
|
||||||
//
|
//
|
||||||
this.uiLabel3.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLabel3.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLabel3.Location = new System.Drawing.Point(30, 524);
|
this.uiLabel3.Location = new System.Drawing.Point(30, 524);
|
||||||
this.uiLabel3.Name = "uiLabel3";
|
this.uiLabel3.Name = "uiLabel3";
|
||||||
this.uiLabel3.Size = new System.Drawing.Size(172, 23);
|
this.uiLabel3.Size = new System.Drawing.Size(172, 23);
|
||||||
@ -321,6 +331,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiLabel4
|
// uiLabel4
|
||||||
//
|
//
|
||||||
this.uiLabel4.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLabel4.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLabel4.Location = new System.Drawing.Point(30, 476);
|
this.uiLabel4.Location = new System.Drawing.Point(30, 476);
|
||||||
this.uiLabel4.Name = "uiLabel4";
|
this.uiLabel4.Name = "uiLabel4";
|
||||||
this.uiLabel4.Size = new System.Drawing.Size(85, 23);
|
this.uiLabel4.Size = new System.Drawing.Size(85, 23);
|
||||||
@ -359,6 +370,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiLabel5
|
// uiLabel5
|
||||||
//
|
//
|
||||||
this.uiLabel5.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLabel5.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLabel5.Location = new System.Drawing.Point(511, 524);
|
this.uiLabel5.Location = new System.Drawing.Point(511, 524);
|
||||||
this.uiLabel5.Name = "uiLabel5";
|
this.uiLabel5.Name = "uiLabel5";
|
||||||
this.uiLabel5.Size = new System.Drawing.Size(59, 23);
|
this.uiLabel5.Size = new System.Drawing.Size(59, 23);
|
||||||
@ -396,7 +408,7 @@ namespace Sunny.UI.Demo
|
|||||||
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
|
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
|
||||||
this.PageIndex = 999;
|
this.PageIndex = 999;
|
||||||
this.ShowTitle = true;
|
this.ShowTitle = true;
|
||||||
this.Symbol = 262210;
|
this.Symbol = 558295;
|
||||||
this.Text = "多彩主题";
|
this.Text = "多彩主题";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
@ -123,12 +123,12 @@ namespace Sunny.UI.Demo
|
|||||||
|
|
||||||
private void uiSymbolButton2_Click(object sender, EventArgs e)
|
private void uiSymbolButton2_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.ShowInfoNotifier("Info", InfoNotifierClick);
|
this.ShowInfoNotifier("Hello SunnyUI!", InfoNotifierClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InfoNotifierClick(object sender, EventArgs e)
|
private void InfoNotifierClick(object sender, DescriptionEventArgs e)
|
||||||
{
|
{
|
||||||
this.ShowInfoTip(CodeTranslator.Current.PressedNotifier);
|
this.ShowInfoTip(e.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uiSymbolButton6_Click(object sender, EventArgs e)
|
private void uiSymbolButton6_Click(object sender, EventArgs e)
|
||||||
|
18
SunnyUI.Demo/Industrial/FLed.Designer.cs
generated
18
SunnyUI.Demo/Industrial/FLed.Designer.cs
generated
@ -56,6 +56,7 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiDigitalLabel2 = new Sunny.UI.UIDigitalLabel();
|
this.uiDigitalLabel2 = new Sunny.UI.UIDigitalLabel();
|
||||||
this.uiDigitalLabel1 = new Sunny.UI.UIDigitalLabel();
|
this.uiDigitalLabel1 = new Sunny.UI.UIDigitalLabel();
|
||||||
this.uiLine4 = new Sunny.UI.UILine();
|
this.uiLine4 = new Sunny.UI.UILine();
|
||||||
|
this.uiBattery7 = new Sunny.UI.UIBattery();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// uiBattery6
|
// uiBattery6
|
||||||
@ -170,7 +171,7 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLedStopwatch1.Name = "uiLedStopwatch1";
|
this.uiLedStopwatch1.Name = "uiLedStopwatch1";
|
||||||
this.uiLedStopwatch1.Size = new System.Drawing.Size(190, 34);
|
this.uiLedStopwatch1.Size = new System.Drawing.Size(190, 34);
|
||||||
this.uiLedStopwatch1.TabIndex = 61;
|
this.uiLedStopwatch1.TabIndex = 61;
|
||||||
this.uiLedStopwatch1.Text = "12:50";
|
this.uiLedStopwatch1.Text = "01:05";
|
||||||
//
|
//
|
||||||
// uiLedDisplay1
|
// uiLedDisplay1
|
||||||
//
|
//
|
||||||
@ -359,11 +360,25 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLine4.Text = "UIDigitalLabel";
|
this.uiLine4.Text = "UIDigitalLabel";
|
||||||
this.uiLine4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.uiLine4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
//
|
//
|
||||||
|
// uiBattery7
|
||||||
|
//
|
||||||
|
this.uiBattery7.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiBattery7.Location = new System.Drawing.Point(42, 410);
|
||||||
|
this.uiBattery7.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
|
this.uiBattery7.Name = "uiBattery7";
|
||||||
|
this.uiBattery7.Size = new System.Drawing.Size(73, 105);
|
||||||
|
this.uiBattery7.SymbolOffset = new System.Drawing.Point(1, 3);
|
||||||
|
this.uiBattery7.SymbolRotate = 270;
|
||||||
|
this.uiBattery7.SymbolSize = 100;
|
||||||
|
this.uiBattery7.TabIndex = 110;
|
||||||
|
this.uiBattery7.Text = "uiBattery7";
|
||||||
|
//
|
||||||
// FLed
|
// FLed
|
||||||
//
|
//
|
||||||
this.AllowShowTitle = true;
|
this.AllowShowTitle = true;
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 555);
|
this.ClientSize = new System.Drawing.Size(800, 555);
|
||||||
|
this.Controls.Add(this.uiBattery7);
|
||||||
this.Controls.Add(this.uiLine4);
|
this.Controls.Add(this.uiLine4);
|
||||||
this.Controls.Add(this.uiDigitalLabel2);
|
this.Controls.Add(this.uiDigitalLabel2);
|
||||||
this.Controls.Add(this.uiDigitalLabel1);
|
this.Controls.Add(this.uiDigitalLabel1);
|
||||||
@ -426,5 +441,6 @@ namespace Sunny.UI.Demo
|
|||||||
private UIDigitalLabel uiDigitalLabel2;
|
private UIDigitalLabel uiDigitalLabel2;
|
||||||
private UIDigitalLabel uiDigitalLabel1;
|
private UIDigitalLabel uiDigitalLabel1;
|
||||||
private UILine uiLine4;
|
private UILine uiLine4;
|
||||||
|
private UIBattery uiBattery7;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,7 @@
|
|||||||
private void timer1_Tick(object sender, System.EventArgs e)
|
private void timer1_Tick(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
value++;
|
value++;
|
||||||
uiBattery1.Power = value;
|
uiBattery7.Power = uiBattery1.Power = value;
|
||||||
uiLedDisplay1.Text = value + " Ω";
|
uiLedDisplay1.Text = value + " Ω";
|
||||||
uiDigitalLabel2.Value += 0.1;
|
uiDigitalLabel2.Value += 0.1;
|
||||||
}
|
}
|
||||||
|
118
SunnyUI.Demo/Industrial/FLight.Designer.cs
generated
118
SunnyUI.Demo/Industrial/FLight.Designer.cs
generated
@ -45,6 +45,12 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLedBulb6 = new Sunny.UI.UILedBulb();
|
this.uiLedBulb6 = new Sunny.UI.UILedBulb();
|
||||||
this.uiLight5 = new Sunny.UI.UILight();
|
this.uiLight5 = new Sunny.UI.UILight();
|
||||||
this.uiLight6 = new Sunny.UI.UILight();
|
this.uiLight6 = new Sunny.UI.UILight();
|
||||||
|
this.uiStatusBox1 = new Sunny.UI.UIStatusBox();
|
||||||
|
this.uiLine1 = new Sunny.UI.UILine();
|
||||||
|
this.uiButton1 = new Sunny.UI.UIButton();
|
||||||
|
this.uiButton2 = new Sunny.UI.UIButton();
|
||||||
|
this.uiButton3 = new Sunny.UI.UIButton();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.uiStatusBox1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// uiLedBulb4
|
// uiLedBulb4
|
||||||
@ -78,7 +84,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiLine8
|
// uiLine8
|
||||||
//
|
//
|
||||||
|
this.uiLine8.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLine8.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLine8.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLine8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLine8.Location = new System.Drawing.Point(381, 55);
|
this.uiLine8.Location = new System.Drawing.Point(381, 55);
|
||||||
this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16);
|
this.uiLine8.MinimumSize = new System.Drawing.Size(16, 16);
|
||||||
this.uiLine8.Name = "uiLine8";
|
this.uiLine8.Name = "uiLine8";
|
||||||
@ -144,7 +152,9 @@ namespace Sunny.UI.Demo
|
|||||||
//
|
//
|
||||||
// uiLine2
|
// uiLine2
|
||||||
//
|
//
|
||||||
|
this.uiLine2.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLine2.Font = new System.Drawing.Font("宋体", 12F);
|
this.uiLine2.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLine2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
this.uiLine2.Location = new System.Drawing.Point(30, 55);
|
this.uiLine2.Location = new System.Drawing.Point(30, 55);
|
||||||
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
this.uiLine2.MinimumSize = new System.Drawing.Size(16, 16);
|
||||||
this.uiLine2.Name = "uiLine2";
|
this.uiLine2.Name = "uiLine2";
|
||||||
@ -223,11 +233,113 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiLight6.TabIndex = 75;
|
this.uiLight6.TabIndex = 75;
|
||||||
this.uiLight6.Text = "uiLight6";
|
this.uiLight6.Text = "uiLight6";
|
||||||
//
|
//
|
||||||
|
// uiStatusBox1
|
||||||
|
//
|
||||||
|
this.uiStatusBox1.Image = global::Sunny.UI.Demo.Properties.Resources.led_g;
|
||||||
|
this.uiStatusBox1.Location = new System.Drawing.Point(30, 272);
|
||||||
|
this.uiStatusBox1.Name = "uiStatusBox1";
|
||||||
|
this.uiStatusBox1.Size = new System.Drawing.Size(36, 36);
|
||||||
|
this.uiStatusBox1.Status1 = global::Sunny.UI.Demo.Properties.Resources.led_g;
|
||||||
|
this.uiStatusBox1.Status2 = global::Sunny.UI.Demo.Properties.Resources.led_y;
|
||||||
|
this.uiStatusBox1.Status3 = global::Sunny.UI.Demo.Properties.Resources.led_r;
|
||||||
|
this.uiStatusBox1.TabIndex = 77;
|
||||||
|
this.uiStatusBox1.TabStop = false;
|
||||||
|
//
|
||||||
|
// uiLine1
|
||||||
|
//
|
||||||
|
this.uiLine1.BackColor = System.Drawing.Color.Transparent;
|
||||||
|
this.uiLine1.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
|
this.uiLine1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
|
this.uiLine1.Location = new System.Drawing.Point(30, 230);
|
||||||
|
this.uiLine1.MinimumSize = new System.Drawing.Size(16, 16);
|
||||||
|
this.uiLine1.Name = "uiLine1";
|
||||||
|
this.uiLine1.Size = new System.Drawing.Size(319, 20);
|
||||||
|
this.uiLine1.TabIndex = 79;
|
||||||
|
this.uiLine1.Text = "UILight";
|
||||||
|
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
|
// uiButton1
|
||||||
|
//
|
||||||
|
this.uiButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.uiButton1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton1.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton1.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(139)))), ((int)(((byte)(203)))), ((int)(((byte)(83)))));
|
||||||
|
this.uiButton1.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton1.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton1.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(245)))), ((int)(((byte)(251)))), ((int)(((byte)(241)))));
|
||||||
|
this.uiButton1.Location = new System.Drawing.Point(78, 273);
|
||||||
|
this.uiButton1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
|
this.uiButton1.Name = "uiButton1";
|
||||||
|
this.uiButton1.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(190)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton1.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(139)))), ((int)(((byte)(203)))), ((int)(((byte)(83)))));
|
||||||
|
this.uiButton1.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton1.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(152)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton1.Size = new System.Drawing.Size(75, 35);
|
||||||
|
this.uiButton1.Style = Sunny.UI.UIStyle.Custom;
|
||||||
|
this.uiButton1.TabIndex = 80;
|
||||||
|
this.uiButton1.Text = "切换";
|
||||||
|
this.uiButton1.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton1.Click += new System.EventHandler(this.uiButton1_Click);
|
||||||
|
//
|
||||||
|
// uiButton2
|
||||||
|
//
|
||||||
|
this.uiButton2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.uiButton2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton2.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton2.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(175)))), ((int)(((byte)(83)))));
|
||||||
|
this.uiButton2.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton2.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton2.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(249)))), ((int)(((byte)(241)))));
|
||||||
|
this.uiButton2.Location = new System.Drawing.Point(159, 273);
|
||||||
|
this.uiButton2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
|
this.uiButton2.Name = "uiButton2";
|
||||||
|
this.uiButton2.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(155)))), ((int)(((byte)(40)))));
|
||||||
|
this.uiButton2.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(227)))), ((int)(((byte)(175)))), ((int)(((byte)(83)))));
|
||||||
|
this.uiButton2.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton2.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(176)))), ((int)(((byte)(124)))), ((int)(((byte)(32)))));
|
||||||
|
this.uiButton2.Size = new System.Drawing.Size(75, 35);
|
||||||
|
this.uiButton2.Style = Sunny.UI.UIStyle.Custom;
|
||||||
|
this.uiButton2.TabIndex = 81;
|
||||||
|
this.uiButton2.Text = "切换";
|
||||||
|
this.uiButton2.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton2.Click += new System.EventHandler(this.uiButton2_Click);
|
||||||
|
//
|
||||||
|
// uiButton3
|
||||||
|
//
|
||||||
|
this.uiButton3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.uiButton3.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||||
|
this.uiButton3.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||||
|
this.uiButton3.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
|
||||||
|
this.uiButton3.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
|
this.uiButton3.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
|
this.uiButton3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton3.LightColor = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
|
||||||
|
this.uiButton3.Location = new System.Drawing.Point(240, 273);
|
||||||
|
this.uiButton3.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
|
this.uiButton3.Name = "uiButton3";
|
||||||
|
this.uiButton3.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
|
||||||
|
this.uiButton3.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
|
||||||
|
this.uiButton3.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
|
this.uiButton3.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
|
this.uiButton3.Size = new System.Drawing.Size(75, 35);
|
||||||
|
this.uiButton3.Style = Sunny.UI.UIStyle.Custom;
|
||||||
|
this.uiButton3.TabIndex = 82;
|
||||||
|
this.uiButton3.Text = "切换";
|
||||||
|
this.uiButton3.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||||
|
this.uiButton3.Click += new System.EventHandler(this.uiButton3_Click);
|
||||||
|
//
|
||||||
// FLight
|
// FLight
|
||||||
//
|
//
|
||||||
this.AllowShowTitle = true;
|
this.AllowShowTitle = true;
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.uiButton3);
|
||||||
|
this.Controls.Add(this.uiButton2);
|
||||||
|
this.Controls.Add(this.uiButton1);
|
||||||
|
this.Controls.Add(this.uiLine1);
|
||||||
|
this.Controls.Add(this.uiStatusBox1);
|
||||||
this.Controls.Add(this.uiLight5);
|
this.Controls.Add(this.uiLight5);
|
||||||
this.Controls.Add(this.uiLight6);
|
this.Controls.Add(this.uiLight6);
|
||||||
this.Controls.Add(this.uiLedBulb5);
|
this.Controls.Add(this.uiLedBulb5);
|
||||||
@ -247,6 +359,7 @@ namespace Sunny.UI.Demo
|
|||||||
this.ShowTitle = true;
|
this.ShowTitle = true;
|
||||||
this.Symbol = 362751;
|
this.Symbol = 362751;
|
||||||
this.Text = "Light";
|
this.Text = "Light";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.uiStatusBox1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -267,5 +380,10 @@ namespace Sunny.UI.Demo
|
|||||||
private UILedBulb uiLedBulb6;
|
private UILedBulb uiLedBulb6;
|
||||||
private UILight uiLight5;
|
private UILight uiLight5;
|
||||||
private UILight uiLight6;
|
private UILight uiLight6;
|
||||||
|
private UIStatusBox uiStatusBox1;
|
||||||
|
private UILine uiLine1;
|
||||||
|
private UIButton uiButton1;
|
||||||
|
private UIButton uiButton2;
|
||||||
|
private UIButton uiButton3;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,5 +6,27 @@
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum LightState
|
||||||
|
{
|
||||||
|
Green = 1,
|
||||||
|
Yellow = 2,
|
||||||
|
Red = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiButton1_Click(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
uiStatusBox1.Status = (int)LightState.Green;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiButton2_Click(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
uiStatusBox1.Status = (int)LightState.Yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uiButton3_Click(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
uiStatusBox1.Status = (int)LightState.Red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||||
//通过使用 "*",如下所示:
|
//通过使用 "*",如下所示:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("3.6.6.0")]
|
[assembly: AssemblyVersion("3.8.0.1")]
|
||||||
[assembly: AssemblyFileVersion("3.6.6.0")]
|
[assembly: AssemblyFileVersion("3.8.0.1")]
|
||||||
|
30
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
30
SunnyUI.Demo/Properties/Resources.Designer.cs
generated
@ -470,6 +470,36 @@ namespace Sunny.UI.Demo.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap led_g {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("led_g", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap led_r {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("led_r", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap led_y {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("led_y", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -214,6 +214,15 @@
|
|||||||
<data name="lazio" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="lazio" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\lazio.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\lazio.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="led_g" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\led_g.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="led_r" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\led_r.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="led_y" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\led_y.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="mallorca" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="mallorca" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\mallorca.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\mallorca.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
BIN
SunnyUI.Demo/Resources/led_g.png
Normal file
BIN
SunnyUI.Demo/Resources/led_g.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
SunnyUI.Demo/Resources/led_r.png
Normal file
BIN
SunnyUI.Demo/Resources/led_r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
BIN
SunnyUI.Demo/Resources/led_y.png
Normal file
BIN
SunnyUI.Demo/Resources/led_y.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -41,36 +41,33 @@
|
|||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SunnyUI, Version=3.7.2.0, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb, processorArchitecture=MSIL">
|
<Reference Include="SunnyUI, Version=3.8.3.0, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SunnyUI.3.7.2\lib\net472\SunnyUI.dll</HintPath>
|
<HintPath>..\packages\SunnyUI.3.8.3\lib\net472\SunnyUI.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SunnyUI.COM, Version=6.3.3.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SunnyUI.COM, Version=9.0.3.1, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SunnyUI.COM.6.3.3\lib\net472\SunnyUI.COM.dll</HintPath>
|
<HintPath>..\packages\SunnyUI.COM.9.0.3.1\lib\net472\SunnyUI.COM.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SunnyUI.Common, Version=3.7.2.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
|
<Reference Include="SunnyUI.Common, Version=3.8.3.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SunnyUI.Common.3.7.2\lib\net472\SunnyUI.Common.dll</HintPath>
|
<HintPath>..\packages\SunnyUI.Common.3.8.3\lib\net472\SunnyUI.Common.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SunnyUI.FrameDecoder, Version=7.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SunnyUI.FrameDecoder, Version=7.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SunnyUI.FrameDecoder.7.1.6\lib\net472\SunnyUI.FrameDecoder.dll</HintPath>
|
<HintPath>..\packages\SunnyUI.FrameDecoder.7.6.0\lib\net472\SunnyUI.FrameDecoder.dll</HintPath>
|
||||||
</Reference>
|
|
||||||
<Reference Include="SunnyUI.Serialization, Version=6.3.6.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\SunnyUI.Serialization.6.3.6\lib\net472\SunnyUI.Serialization.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
<HintPath>..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Design" />
|
<Reference Include="System.Design" />
|
||||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
<HintPath>..\packages\System.Memory.4.6.3\lib\net462\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.2\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@ -775,6 +772,9 @@
|
|||||||
<None Include="Resources\Tom.gif" />
|
<None Include="Resources\Tom.gif" />
|
||||||
<None Include="Resources\Sunny24.png" />
|
<None Include="Resources\Sunny24.png" />
|
||||||
<None Include="Resources\SunnyUI72.png" />
|
<None Include="Resources\SunnyUI72.png" />
|
||||||
|
<None Include="Resources\led_g.png" />
|
||||||
|
<None Include="Resources\led_r.png" />
|
||||||
|
<None Include="Resources\led_y.png" />
|
||||||
<Content Include="SunnyUI.ico" />
|
<Content Include="SunnyUI.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
@ -9,7 +9,15 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-6.0.3.0" newVersion="6.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="SunnyUI" version="3.7.2" targetFramework="net472" />
|
<package id="SunnyUI" version="3.8.3" targetFramework="net472" />
|
||||||
<package id="SunnyUI.COM" version="6.3.3" targetFramework="net472" />
|
<package id="SunnyUI.COM" version="9.0.3.1" targetFramework="net472" />
|
||||||
<package id="SunnyUI.Common" version="3.7.2" targetFramework="net472" />
|
<package id="SunnyUI.Common" version="3.8.3" targetFramework="net472" />
|
||||||
<package id="SunnyUI.FrameDecoder" version="7.1.6" targetFramework="net472" />
|
<package id="SunnyUI.FrameDecoder" version="7.6.0" targetFramework="net472" />
|
||||||
<package id="SunnyUI.Serialization" version="6.3.6" targetFramework="net472" />
|
<package id="System.Buffers" version="4.6.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
|
<package id="System.Memory" version="4.6.3" targetFramework="net472" />
|
||||||
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
|
<package id="System.Numerics.Vectors" version="4.6.1" targetFramework="net472" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.2" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
|
|
||||||
</packages>
|
</packages>
|
@ -2,3 +2,139 @@
|
|||||||
|
|
||||||
# Default severity for analyzer diagnostics with category 'Style'
|
# Default severity for analyzer diagnostics with category 'Style'
|
||||||
dotnet_analyzer_diagnostic.category-Style.severity = none
|
dotnet_analyzer_diagnostic.category-Style.severity = none
|
||||||
|
# WFO1000: A property should determine its property content serialization with the DesignerSerializationVisibilityAttribute, DefaultValueAttribute or the ShouldSerializeProperty method
|
||||||
|
dotnet_diagnostic.WFO1000.severity = silent
|
||||||
|
csharp_using_directive_placement = outside_namespace:silent
|
||||||
|
csharp_style_expression_bodied_methods = false:silent
|
||||||
|
csharp_style_expression_bodied_constructors = false:silent
|
||||||
|
csharp_style_expression_bodied_operators = false:silent
|
||||||
|
csharp_style_expression_bodied_properties = true:silent
|
||||||
|
csharp_style_expression_bodied_indexers = true:silent
|
||||||
|
csharp_style_expression_bodied_accessors = true:silent
|
||||||
|
csharp_style_expression_bodied_lambdas = true:silent
|
||||||
|
csharp_style_expression_bodied_local_functions = false:silent
|
||||||
|
csharp_style_conditional_delegate_call = true:suggestion
|
||||||
|
csharp_style_var_for_built_in_types = false:silent
|
||||||
|
csharp_space_around_binary_operators = before_and_after
|
||||||
|
csharp_indent_labels = one_less_than_current
|
||||||
|
csharp_style_var_when_type_is_apparent = false:silent
|
||||||
|
csharp_style_var_elsewhere = false:silent
|
||||||
|
csharp_prefer_simple_using_statement = true:suggestion
|
||||||
|
csharp_prefer_braces = true:silent
|
||||||
|
csharp_style_namespace_declarations = block_scoped:silent
|
||||||
|
csharp_style_prefer_method_group_conversion = true:silent
|
||||||
|
csharp_style_prefer_top_level_statements = true:silent
|
||||||
|
csharp_style_prefer_primary_constructors = true:suggestion
|
||||||
|
csharp_prefer_system_threading_lock = true:suggestion
|
||||||
|
csharp_prefer_static_local_function = true:suggestion
|
||||||
|
csharp_prefer_static_anonymous_function = true:suggestion
|
||||||
|
csharp_style_prefer_readonly_struct = true:suggestion
|
||||||
|
csharp_style_prefer_readonly_struct_member = true:suggestion
|
||||||
|
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
|
||||||
|
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
|
||||||
|
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
|
||||||
|
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
|
||||||
|
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
|
||||||
|
csharp_style_prefer_switch_expression = true:suggestion
|
||||||
|
csharp_style_prefer_pattern_matching = true:silent
|
||||||
|
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||||
|
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||||
|
csharp_style_prefer_not_pattern = true:suggestion
|
||||||
|
csharp_style_prefer_extended_property_pattern = true:suggestion
|
||||||
|
csharp_style_throw_expression = true:suggestion
|
||||||
|
csharp_style_prefer_null_check_over_type_check = true:suggestion
|
||||||
|
csharp_prefer_simple_default_expression = true:suggestion
|
||||||
|
csharp_style_prefer_local_over_anonymous_function = true:suggestion
|
||||||
|
csharp_style_prefer_index_operator = true:suggestion
|
||||||
|
csharp_style_prefer_range_operator = true:suggestion
|
||||||
|
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
|
||||||
|
csharp_style_prefer_tuple_swap = true:suggestion
|
||||||
|
csharp_style_prefer_utf8_string_literals = true:suggestion
|
||||||
|
csharp_style_inlined_variable_declaration = true:suggestion
|
||||||
|
csharp_style_deconstructed_variable_declaration = true:suggestion
|
||||||
|
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||||
|
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||||
|
|
||||||
|
[*.{cs,vb}]
|
||||||
|
#### 命名样式 ####
|
||||||
|
|
||||||
|
# 命名规则
|
||||||
|
|
||||||
|
dotnet_naming_rule.interface_should_be_以_i_开始.severity = suggestion
|
||||||
|
dotnet_naming_rule.interface_should_be_以_i_开始.symbols = interface
|
||||||
|
dotnet_naming_rule.interface_should_be_以_i_开始.style = 以_i_开始
|
||||||
|
|
||||||
|
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.severity = suggestion
|
||||||
|
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.symbols = 类型
|
||||||
|
dotnet_naming_rule.类型_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
|
||||||
|
|
||||||
|
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.severity = suggestion
|
||||||
|
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.symbols = 非字段成员
|
||||||
|
dotnet_naming_rule.非字段成员_should_be_帕斯卡拼写法.style = 帕斯卡拼写法
|
||||||
|
|
||||||
|
# 符号规范
|
||||||
|
|
||||||
|
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||||
|
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.interface.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.类型.applicable_kinds = class, struct, interface, enum
|
||||||
|
dotnet_naming_symbols.类型.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.类型.required_modifiers =
|
||||||
|
|
||||||
|
dotnet_naming_symbols.非字段成员.applicable_kinds = property, event, method
|
||||||
|
dotnet_naming_symbols.非字段成员.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||||
|
dotnet_naming_symbols.非字段成员.required_modifiers =
|
||||||
|
|
||||||
|
# 命名样式
|
||||||
|
|
||||||
|
dotnet_naming_style.以_i_开始.required_prefix = I
|
||||||
|
dotnet_naming_style.以_i_开始.required_suffix =
|
||||||
|
dotnet_naming_style.以_i_开始.word_separator =
|
||||||
|
dotnet_naming_style.以_i_开始.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.required_prefix =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.required_suffix =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.word_separator =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
|
||||||
|
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.required_prefix =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.required_suffix =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.word_separator =
|
||||||
|
dotnet_naming_style.帕斯卡拼写法.capitalization = pascal_case
|
||||||
|
end_of_line = crlf
|
||||||
|
dotnet_style_qualification_for_field = false:silent
|
||||||
|
dotnet_style_qualification_for_property = false:silent
|
||||||
|
dotnet_style_qualification_for_method = false:silent
|
||||||
|
dotnet_style_qualification_for_event = false:silent
|
||||||
|
tab_width = 4
|
||||||
|
indent_size = 4
|
||||||
|
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||||
|
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||||
|
dotnet_code_quality_unused_parameters = all:suggestion
|
||||||
|
dotnet_style_readonly_field = true:suggestion
|
||||||
|
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||||
|
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||||
|
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
|
||||||
|
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
|
||||||
|
dotnet_style_coalesce_expression = true:suggestion
|
||||||
|
dotnet_style_null_propagation = true:suggestion
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
|
||||||
|
dotnet_style_prefer_auto_properties = true:silent
|
||||||
|
dotnet_style_object_initializer = true:suggestion
|
||||||
|
dotnet_style_collection_initializer = true:suggestion
|
||||||
|
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
|
||||||
|
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||||
|
dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||||
|
dotnet_style_explicit_tuple_names = true:suggestion
|
||||||
|
dotnet_style_prefer_inferred_tuple_names = true:suggestion
|
||||||
|
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
|
||||||
|
dotnet_style_prefer_compound_assignment = true:suggestion
|
||||||
|
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||||
|
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
|
||||||
|
dotnet_style_namespace_match_folder = true:suggestion
|
||||||
|
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
|
||||||
|
dotnet_style_predefined_type_for_member_access = true:silent
|
||||||
|
dotnet_diagnostic.CA2022.severity = silent
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -31,7 +31,9 @@
|
|||||||
* 2023-05-13: V3.3.6 Option.BarInterval,设置Bar之间间隔,默认-1,自动计算间隔
|
* 2023-05-13: V3.3.6 Option.BarInterval,设置Bar之间间隔,默认-1,自动计算间隔
|
||||||
* 2023-05-14: V3.3.6 重构DrawString函数
|
* 2023-05-14: V3.3.6 重构DrawString函数
|
||||||
* 2023-06-06: V3.3.7 修复Y轴文字居中
|
* 2023-06-06: V3.3.7 修复Y轴文字居中
|
||||||
* 2025-06-08: V3.6.6 修复X轴文字带角度显示时居中
|
* 2024-06-08: V3.6.6 修复X轴文字带角度显示时居中
|
||||||
|
* 2024-10-25: V3.7.2 增加了一个快捷的显示数据函数ShowData
|
||||||
|
* 2025-03-05: V3.8.1 增加Y轴零度线偏移量,Option.ZeroLineOffset
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -48,6 +50,7 @@ namespace Sunny.UI
|
|||||||
/// 柱状图
|
/// 柱状图
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("柱状图控件")]
|
||||||
public class UIBarChart : UIChart
|
public class UIBarChart : UIChart
|
||||||
{
|
{
|
||||||
private bool NeedDraw;
|
private bool NeedDraw;
|
||||||
@ -209,7 +212,7 @@ namespace Sunny.UI
|
|||||||
float ww = Math.Min(x2, series.MaxWidth);
|
float ww = Math.Min(x2, series.MaxWidth);
|
||||||
xx -= ww / 2.0f;
|
xx -= ww / 2.0f;
|
||||||
|
|
||||||
float YZeroPos = YScale.CalcYPixel(0, DrawOrigin.Y, DrawSize.Height);
|
float YZeroPos = YScale.CalcYPixel(Option.ZeroLineOffset, DrawOrigin.Y, DrawSize.Height);
|
||||||
float VPos = YScale.CalcYPixel(series.Data[j], DrawOrigin.Y, DrawSize.Height);
|
float VPos = YScale.CalcYPixel(series.Data[j], DrawOrigin.Y, DrawSize.Height);
|
||||||
|
|
||||||
if (VPos <= YZeroPos)
|
if (VPos <= YZeroPos)
|
||||||
@ -255,7 +258,7 @@ namespace Sunny.UI
|
|||||||
float ww = Math.Min(x2, series.MaxWidth);
|
float ww = Math.Min(x2, series.MaxWidth);
|
||||||
float xl = (DrawBarWidth - Option.SeriesCount * ww - (Option.SeriesCount - 1) * Option.BarInterval) / 2.0f;
|
float xl = (DrawBarWidth - Option.SeriesCount * ww - (Option.SeriesCount - 1) * Option.BarInterval) / 2.0f;
|
||||||
float xx = barX + xl + i * ww + i * Option.BarInterval;
|
float xx = barX + xl + i * ww + i * Option.BarInterval;
|
||||||
float YZeroPos = YScale.CalcYPixel(0, DrawOrigin.Y, DrawSize.Height);
|
float YZeroPos = YScale.CalcYPixel(Option.ZeroLineOffset, DrawOrigin.Y, DrawSize.Height);
|
||||||
float VPos = YScale.CalcYPixel(series.Data[j], DrawOrigin.Y, DrawSize.Height);
|
float VPos = YScale.CalcYPixel(series.Data[j], DrawOrigin.Y, DrawSize.Height);
|
||||||
|
|
||||||
if (VPos <= YZeroPos)
|
if (VPos <= YZeroPos)
|
||||||
@ -536,6 +539,11 @@ namespace Sunny.UI
|
|||||||
double[] YLabels = YScale.CalcLabels();
|
double[] YLabels = YScale.CalcLabels();
|
||||||
float[] labels = YScale.CalcYPixels(YLabels, DrawOrigin.Y, DrawSize.Height);
|
float[] labels = YScale.CalcYPixels(YLabels, DrawOrigin.Y, DrawSize.Height);
|
||||||
float wmax = 0;
|
float wmax = 0;
|
||||||
|
|
||||||
|
using Pen pn = new Pen(ForeColor);
|
||||||
|
pn.DashStyle = DashStyle.Dash;
|
||||||
|
pn.DashPattern = new float[] { 3, 3 };
|
||||||
|
|
||||||
for (int i = 0; i < labels.Length; i++)
|
for (int i = 0; i < labels.Length; i++)
|
||||||
{
|
{
|
||||||
if (labels[i] > DrawOrigin.Y) continue;
|
if (labels[i] > DrawOrigin.Y) continue;
|
||||||
@ -546,17 +554,16 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
if (YLabels[i].IsNanOrInfinity()) continue;
|
if (YLabels[i].IsNanOrInfinity()) continue;
|
||||||
if (!Option.YAxis.ShowGridLine) continue;
|
if (!Option.YAxis.ShowGridLine) continue;
|
||||||
if (!YLabels[i].EqualsDouble(0))
|
//if (!YLabels[i].EqualsDouble(Option.ZeroLineOffset))
|
||||||
{
|
//{
|
||||||
using Pen pn = new Pen(ForeColor);
|
|
||||||
pn.DashStyle = DashStyle.Dash;
|
g.DrawLine(pn, DrawOrigin.X, labels[i], Width - Option.Grid.Right, labels[i]);
|
||||||
pn.DashPattern = new float[] { 3, 3 };
|
|
||||||
g.DrawLine(pn, DrawOrigin.X, labels[i], Width - Option.Grid.Right, labels[i]);
|
//}
|
||||||
}
|
//else
|
||||||
else
|
//{
|
||||||
{
|
// g.DrawLine(ForeColor, DrawOrigin.X, labels[i], Width - Option.Grid.Right, labels[i]);
|
||||||
g.DrawLine(ForeColor, DrawOrigin.X, labels[i], Width - Option.Grid.Right, labels[i]);
|
//}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Option.YAxis.AxisLabel.Show)
|
if (Option.YAxis.AxisLabel.Show)
|
||||||
@ -575,6 +582,9 @@ namespace Sunny.UI
|
|||||||
float yy = Option.Grid.Top + DrawSize.Height / 2.0f;
|
float yy = Option.Grid.Top + DrawSize.Height / 2.0f;
|
||||||
g.DrawRotateString(Option.YAxis.Name, TempFont, ForeColor, new PointF(xx, yy), 270);
|
g.DrawRotateString(Option.YAxis.Name, TempFont, ForeColor, new PointF(xx, yy), 270);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float YZeroPos = YScale.CalcYPixel(Option.ZeroLineOffset, DrawOrigin.Y, DrawSize.Height);
|
||||||
|
g.DrawLine(ForeColor, DrawOrigin.X, YZeroPos, Width - Option.Grid.Right, YZeroPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawAxisScales(Graphics g)
|
private void DrawAxisScales(Graphics g)
|
||||||
@ -646,5 +656,23 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public UIBarSeries Series { get; set; }
|
public UIBarSeries Series { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowData(string[] labels, double[] values, string title = "")
|
||||||
|
{
|
||||||
|
int len = Math.Min(labels.Length, values.Length);
|
||||||
|
if (len == 0) return;
|
||||||
|
|
||||||
|
UIBarOption option = new UIBarOption();
|
||||||
|
option.Title.Text = title;
|
||||||
|
var series = new UIBarSeries();
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
option.XAxis.Data.Add(labels[i]);
|
||||||
|
series.AddData(values[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
option.Series.Add(series);
|
||||||
|
SetOption(option);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -87,6 +87,11 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public int BarInterval { get; set; } = -1;
|
public int BarInterval { get; set; } = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Y轴零度线偏移
|
||||||
|
/// </summary>
|
||||||
|
public double ZeroLineOffset { get; set; } = 0;
|
||||||
|
|
||||||
public void AddSeries(UIBarSeries series)
|
public void AddSeries(UIBarSeries series)
|
||||||
{
|
{
|
||||||
if (series == null)
|
if (series == null)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -73,7 +73,7 @@ namespace Sunny.UI
|
|||||||
tip.Visible = false;
|
tip.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly UITransparentPanel tip = new UITransparentPanel();
|
internal readonly UITransparentPanel tip = new UITransparentPanel();
|
||||||
private UIChartStyleType chartStyleType = UIChartStyleType.Plain;
|
private UIChartStyleType chartStyleType = UIChartStyleType.Plain;
|
||||||
|
|
||||||
[DefaultValue(UIChartStyleType.Plain)]
|
[DefaultValue(UIChartStyleType.Plain)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -32,7 +32,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[ToolboxItem(true), Description("甜甜圈图")]
|
[ToolboxItem(true), Description("甜甜圈图控件")]
|
||||||
public sealed class UIDoughnutChart : UIChart
|
public sealed class UIDoughnutChart : UIChart
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -249,9 +249,9 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
Angle angle = Angles[pieIndex][azIndex];
|
Angle angle = Angles[pieIndex][azIndex];
|
||||||
PointF pf = angle.Center;
|
PointF pf = angle.Center;
|
||||||
if (Drawing.CalcDistance(e.Location, pf) > angle.Outer) continue;
|
if (e.Location.CalcDistance(pf) > angle.Outer) continue;
|
||||||
if (Drawing.CalcDistance(e.Location, pf) < angle.Inner) continue;
|
if (e.Location.CalcDistance(pf) < angle.Inner) continue;
|
||||||
double az = Drawing.CalcAngle(e.Location, pf);
|
double az = e.Location.CalcAngle(pf);
|
||||||
if (az >= angle.Start && az <= angle.Start + angle.Sweep)
|
if (az >= angle.Start && az <= angle.Start + angle.Sweep)
|
||||||
{
|
{
|
||||||
SetPieAndAzIndex(pieIndex, azIndex);
|
SetPieAndAzIndex(pieIndex, azIndex);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -53,6 +53,8 @@
|
|||||||
* 2023-10-20: V3.5.1 增加了绘制线的DashStyle样式
|
* 2023-10-20: V3.5.1 增加了绘制线的DashStyle样式
|
||||||
* 2023-11-22: V3.6.0 增加了区域选择范围相等时不执行事件
|
* 2023-11-22: V3.6.0 增加了区域选择范围相等时不执行事件
|
||||||
* 2024-07-01: V3.6.7 增加了Y轴自定义坐标显示
|
* 2024-07-01: V3.6.7 增加了Y轴自定义坐标显示
|
||||||
|
* 2024-11-13: V3.7.2 增加了鼠标移上绘制十字线样式
|
||||||
|
* 2024-11-14: V3.7.2 增加了鼠标移上绘制十字线颜色
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -67,10 +69,19 @@ using System.Windows.Forms;
|
|||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("曲线图控件")]
|
||||||
public class UILineChart : UIChart
|
public class UILineChart : UIChart
|
||||||
{
|
{
|
||||||
protected bool NeedDraw;
|
protected bool NeedDraw;
|
||||||
|
|
||||||
|
[DefaultValue(MouseLineType.None)]
|
||||||
|
[Description("鼠标移上绘制十字线样式"), Category("SunnyUI")]
|
||||||
|
public MouseLineType MouseLine { get; set; }
|
||||||
|
|
||||||
|
[DefaultValue(typeof(Color), "Red")]
|
||||||
|
[Description("鼠标移上绘制十字线颜色"), Category("SunnyUI")]
|
||||||
|
public Color MouseLineColor { get; set; } = Color.Red;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重载控件尺寸变更
|
/// 重载控件尺寸变更
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -98,7 +109,7 @@ namespace Sunny.UI
|
|||||||
NeedDraw = false;
|
NeedDraw = false;
|
||||||
if (Option?.Series == null || Option.Series.Count == 0) return;
|
if (Option?.Series == null || Option.Series.Count == 0) return;
|
||||||
if (DrawSize.Width <= 0 || DrawSize.Height <= 0) return;
|
if (DrawSize.Width <= 0 || DrawSize.Height <= 0) return;
|
||||||
CalcAxises();
|
CalcAxes();
|
||||||
|
|
||||||
foreach (var series in Option.Series.Values)
|
foreach (var series in Option.Series.Values)
|
||||||
{
|
{
|
||||||
@ -137,7 +148,7 @@ namespace Sunny.UI
|
|||||||
protected UIScale YScale;
|
protected UIScale YScale;
|
||||||
protected UIScale Y2Scale;
|
protected UIScale Y2Scale;
|
||||||
|
|
||||||
protected void CalcAxises()
|
protected void CalcAxes()
|
||||||
{
|
{
|
||||||
if (Option.XAxisType == UIAxisType.DateTime)
|
if (Option.XAxisType == UIAxisType.DateTime)
|
||||||
XScale = new UIDateScale();
|
XScale = new UIDateScale();
|
||||||
@ -289,6 +300,23 @@ namespace Sunny.UI
|
|||||||
DrawAxisScales(g);
|
DrawAxisScales(g);
|
||||||
DrawPointSymbols(g);
|
DrawPointSymbols(g);
|
||||||
DrawOther(g);
|
DrawOther(g);
|
||||||
|
|
||||||
|
if (MousePoint.InRect(DrawRect))
|
||||||
|
{
|
||||||
|
switch (MouseLine)
|
||||||
|
{
|
||||||
|
case MouseLineType.Horizontal:
|
||||||
|
g.DrawLine(MouseLineColor, DrawRect.Left + 1, MousePoint.Y, DrawRect.Right - 1, MousePoint.Y);
|
||||||
|
break;
|
||||||
|
case MouseLineType.Vertical:
|
||||||
|
g.DrawLine(MouseLineColor, MousePoint.X, DrawRect.Top + 1, MousePoint.X, DrawRect.Bottom - 1);
|
||||||
|
break;
|
||||||
|
case MouseLineType.Cross:
|
||||||
|
g.DrawLine(MouseLineColor, DrawRect.Left + 1, MousePoint.Y, DrawRect.Right - 1, MousePoint.Y);
|
||||||
|
g.DrawLine(MouseLineColor, MousePoint.X, DrawRect.Top + 1, MousePoint.X, DrawRect.Bottom - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawAxis(Graphics g)
|
private void DrawAxis(Graphics g)
|
||||||
@ -848,6 +876,7 @@ namespace Sunny.UI
|
|||||||
private readonly List<UILineSelectPoint> selectPoints = new List<UILineSelectPoint>();
|
private readonly List<UILineSelectPoint> selectPoints = new List<UILineSelectPoint>();
|
||||||
private readonly List<UILineSelectPoint> selectPointsTemp = new List<UILineSelectPoint>();
|
private readonly List<UILineSelectPoint> selectPointsTemp = new List<UILineSelectPoint>();
|
||||||
|
|
||||||
|
public Point MousePoint;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重载鼠标移动事件
|
/// 重载鼠标移动事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -955,7 +984,7 @@ namespace Sunny.UI
|
|||||||
using Graphics g = this.CreateGraphics();
|
using Graphics g = this.CreateGraphics();
|
||||||
using var TempFont = Font.DPIScaleFont(UIStyles.DefaultSubFontSize);
|
using var TempFont = Font.DPIScaleFont(UIStyles.DefaultSubFontSize);
|
||||||
Size sf = TextRenderer.MeasureText(sb.ToString(), TempFont);
|
Size sf = TextRenderer.MeasureText(sb.ToString(), TempFont);
|
||||||
tip.Size = new Size(sf.Width + 4, sf.Height + 4);
|
tip.Size = new Size(sf.Width + 4, sf.Height + 10);
|
||||||
|
|
||||||
int x = e.Location.X + 15;
|
int x = e.Location.X + 15;
|
||||||
int y = e.Location.Y + 20;
|
int y = e.Location.Y + 20;
|
||||||
@ -1014,6 +1043,9 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MousePoint = e.Location;
|
||||||
|
if (MouseLine != MouseLineType.None) Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void OnPointValue(object sender, UILineSelectPoint[] points);
|
public delegate void OnPointValue(object sender, UILineSelectPoint[] points);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -33,6 +33,14 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
|
public enum MouseLineType
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Horizontal,
|
||||||
|
Vertical,
|
||||||
|
Cross
|
||||||
|
}
|
||||||
|
|
||||||
public enum UISeriesDataOrder
|
public enum UISeriesDataOrder
|
||||||
{
|
{
|
||||||
X,
|
X,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -32,6 +32,7 @@ using System.Windows.Forms;
|
|||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("饼状图控件")]
|
||||||
public sealed class UIPieChart : UIChart
|
public sealed class UIPieChart : UIChart
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -273,9 +274,9 @@ namespace Sunny.UI
|
|||||||
if (!e.Location.InRect(rect)) continue;
|
if (!e.Location.InRect(rect)) continue;
|
||||||
|
|
||||||
PointF pf = new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f);
|
PointF pf = new PointF(rect.Left + rect.Width / 2.0f, rect.Top + rect.Height / 2.0f);
|
||||||
if (Drawing.CalcDistance(e.Location, pf) * 2 > rect.Width) continue;
|
if (e.Location.CalcDistance(pf) * 2 > rect.Width) continue;
|
||||||
|
|
||||||
double az = Drawing.CalcAngle(e.Location, pf);
|
double az = e.Location.CalcAngle(pf);
|
||||||
for (int azIndex = 0; azIndex < Option.Series[pieIndex].Data.Count; azIndex++)
|
for (int azIndex = 0; azIndex < Option.Series[pieIndex].Data.Count; azIndex++)
|
||||||
{
|
{
|
||||||
Angle angle = Angles[pieIndex][azIndex];
|
Angle angle = Angles[pieIndex][azIndex];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,67 +1,77 @@
|
|||||||
using Microsoft.Win32;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public static class ApplicationEx
|
public static class ApplicationEx
|
||||||
{
|
{
|
||||||
private static string StartUpPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
private static readonly string StartUpPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||||
|
|
||||||
//获取GUID
|
/// <summary>
|
||||||
|
/// 获取当前应用程序的 GUID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>应用程序的 GUID</returns>
|
||||||
public static Guid AppGuid()
|
public static Guid AppGuid()
|
||||||
{
|
{
|
||||||
Assembly asm = Assembly.GetEntryAssembly();
|
var asm = Assembly.GetEntryAssembly();
|
||||||
|
if (asm == null) return Guid.Empty;
|
||||||
object[] attr = (asm.GetCustomAttributes(typeof(GuidAttribute), true));
|
object[] attr = (asm.GetCustomAttributes(typeof(GuidAttribute), true));
|
||||||
return new Guid((attr[0] as GuidAttribute).Value);
|
return attr.Length > 0 && attr[0] is GuidAttribute ga ? new Guid(ga.Value) : Guid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Folder(this Environment.SpecialFolder specialFolder)
|
/// <summary>
|
||||||
{
|
/// 获取指定特殊文件夹的路径,并处理路径格式
|
||||||
return Environment.GetFolderPath(specialFolder).DealPath();
|
/// </summary>
|
||||||
}
|
/// <param name="specialFolder">特殊文件夹枚举</param>
|
||||||
|
/// <returns>处理后的文件夹路径</returns>
|
||||||
|
public static string Folder(this Environment.SpecialFolder specialFolder) => Environment.GetFolderPath(specialFolder).DealPath();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定特殊文件夹下的应用程序文件夹路径,并在必要时创建该文件夹
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="specialFolder">特殊文件夹枚举</param>
|
||||||
|
/// <param name="createIfNotExists">如果文件夹不存在,是否创建</param>
|
||||||
|
/// <returns>应用程序文件夹路径</returns>
|
||||||
public static string FolderWithApplication(this Environment.SpecialFolder specialFolder, bool createIfNotExists = true)
|
public static string FolderWithApplication(this Environment.SpecialFolder specialFolder, bool createIfNotExists = true)
|
||||||
{
|
{
|
||||||
string dir = (specialFolder.Folder() + Application.ProductName).DealPath();
|
var dir = (specialFolder.Folder() + Application.ProductName).DealPath();
|
||||||
if (createIfNotExists) Dir.CreateDir(dir);
|
if (createIfNotExists) Dir.CreateDir(dir);
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用作当前漫游用户的应用程序特定数据的公共储存库的目录。 漫游用户在网络上的多台计算机上工作。 漫游用户的配置文件保留在网络服务器上,并在用户登录时加载到系统中。
|
/// 获取当前漫游用户的应用程序特定数据的公共储存库的目录
|
||||||
/// C:\Users\{YourUserName}\AppData\Roaming\{Application.ProductName}\
|
/// C:\Users\{YourUserName}\AppData\Roaming\{Application.ProductName}\
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>应用程序数据文件夹路径</returns>
|
||||||
public static string ApplicationDataFolder() => Environment.SpecialFolder.ApplicationData.FolderWithApplication();
|
public static string ApplicationDataFolder() => Environment.SpecialFolder.ApplicationData.FolderWithApplication();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用作当前非漫游用户使用的应用程序特定数据的公共储存库的目录。
|
/// 获取当前非漫游用户使用的应用程序特定数据的公共储存库的目录
|
||||||
/// C:\Users\{YourUserName}\AppData\Local\{Application.ProductName}\
|
/// C:\Users\{YourUserName}\AppData\Local\{Application.ProductName}\
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>本地应用程序数据文件夹路径</returns>
|
||||||
public static string LocalApplicationDataFolder() => Environment.SpecialFolder.LocalApplicationData.FolderWithApplication();
|
public static string LocalApplicationDataFolder() => Environment.SpecialFolder.LocalApplicationData.FolderWithApplication();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用作所有用户使用的应用程序特定数据的公共储存库的目录。
|
/// 获取所有用户使用的应用程序特定数据的公共储存库的目录
|
||||||
/// C:\ProgramData \{Application.ProductName}\
|
/// C:\ProgramData \{Application.ProductName}\
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>公共应用程序数据文件夹路径</returns>
|
||||||
public static string CommonApplicationDataFolder() => Environment.SpecialFolder.CommonApplicationData.FolderWithApplication();
|
public static string CommonApplicationDataFolder() => Environment.SpecialFolder.CommonApplicationData.FolderWithApplication();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 增加当前程序到开机自动运行
|
/// 增加当前程序到开机自动运行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="arguments"></param>
|
/// <param name="arguments">启动参数</param>
|
||||||
public static void AddToStartup(string arguments)
|
public static void AddToStartup(string arguments)
|
||||||
{
|
{
|
||||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(StartUpPath, true))
|
using var key = Registry.CurrentUser.OpenSubKey(StartUpPath, true);
|
||||||
{
|
key?.SetValue(Application.ProductName, $"\"{Application.ExecutablePath}\" {arguments}");
|
||||||
key.SetValue(Application.ProductName, "\"" + Application.ExecutablePath + "\" " + arguments);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -69,10 +79,8 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void AddToStartup()
|
public static void AddToStartup()
|
||||||
{
|
{
|
||||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(StartUpPath, true))
|
using var key = Registry.CurrentUser.OpenSubKey(StartUpPath, true);
|
||||||
{
|
key?.SetValue(Application.ProductName, $"\"{Application.ExecutablePath}\"");
|
||||||
key.SetValue(Application.ProductName, "\"" + Application.ExecutablePath + "\"");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -80,22 +88,18 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void RemoveFromStartup()
|
public static void RemoveFromStartup()
|
||||||
{
|
{
|
||||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(StartUpPath, true))
|
using var key = Registry.CurrentUser.OpenSubKey(StartUpPath, true);
|
||||||
{
|
if (Application.ProductName != null) key?.DeleteValue(Application.ProductName, false);
|
||||||
key.DeleteValue(Application.ProductName, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 判断当前程序是否开机自动运行
|
/// 判断当前程序是否开机自动运行
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>是否开机自动运行</returns>
|
||||||
public static bool StartupEnabled()
|
public static bool StartupEnabled()
|
||||||
{
|
{
|
||||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(StartUpPath, false))
|
using var key = Registry.CurrentUser.OpenSubKey(StartUpPath, false);
|
||||||
{
|
return key != null && key.GetValue(Application.ProductName) != null;
|
||||||
return key.GetValue(Application.ProductName) != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -103,30 +107,27 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void CheckAndUpdateStartupPath()
|
public static void CheckAndUpdateStartupPath()
|
||||||
{
|
{
|
||||||
if (StartupEnabled())
|
if (!StartupEnabled()) return;
|
||||||
|
|
||||||
|
string arg = string.Empty;
|
||||||
|
// 从注册表键值中读取启动参数
|
||||||
|
using var key = Registry.CurrentUser.OpenSubKey(StartUpPath, true);
|
||||||
|
if (key == null) return;
|
||||||
|
string oldValue = key.GetValue(Application.ProductName)?.ToString();
|
||||||
|
if (oldValue == null) return;
|
||||||
|
if (oldValue.StartsWith("\""))
|
||||||
{
|
{
|
||||||
string oldValue;
|
arg = string.Join("\"", oldValue.Split('\"').Skip(2)).Trim();
|
||||||
string arg = string.Empty;
|
|
||||||
|
|
||||||
//Read Argument From Registry Key Value
|
|
||||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(StartUpPath, true))
|
|
||||||
{
|
|
||||||
oldValue = key.GetValue(Application.ProductName).ToString();
|
|
||||||
if (oldValue.StartsWith("\""))
|
|
||||||
{
|
|
||||||
arg = string.Join("\"", oldValue.Split('\"').Skip(2)).Trim();
|
|
||||||
}
|
|
||||||
else if (oldValue.Contains(" "))
|
|
||||||
{
|
|
||||||
arg = string.Join(" ", oldValue.Split(' ').Skip(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(arg))
|
|
||||||
AddToStartup();
|
|
||||||
else
|
|
||||||
AddToStartup(arg);
|
|
||||||
}
|
}
|
||||||
|
else if (oldValue.Contains(" "))
|
||||||
|
{
|
||||||
|
arg = string.Join(" ", oldValue.Split(' ').Skip(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(arg))
|
||||||
|
AddToStartup();
|
||||||
|
else
|
||||||
|
AddToStartup(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,33 @@
|
|||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 提供程序集引用的常量定义。
|
||||||
|
/// </summary>
|
||||||
internal static class AssemblyRefEx
|
internal static class AssemblyRefEx
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 程序集版本号。
|
||||||
|
/// </summary>
|
||||||
internal const string Version = "4.0.0.0";
|
internal const string Version = "4.0.0.0";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Microsoft 公钥。
|
||||||
|
/// </summary>
|
||||||
internal const string MicrosoftPublicKey = "b03f5f7f11d50a3a";
|
internal const string MicrosoftPublicKey = "b03f5f7f11d50a3a";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System.Design 程序集引用。
|
||||||
|
/// </summary>
|
||||||
internal const string SystemDesign = "System.Design, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
internal const string SystemDesign = "System.Design, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System.Drawing.Design 程序集引用。
|
||||||
|
/// </summary>
|
||||||
internal const string SystemDrawingDesign = "System.Drawing.Design, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
internal const string SystemDrawingDesign = "System.Drawing.Design, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// System.Drawing 程序集引用。
|
||||||
|
/// </summary>
|
||||||
internal const string SystemDrawing = "System.Drawing, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
internal const string SystemDrawing = "System.Drawing, Version=" + Version + ", Culture=neutral, PublicKeyToken=" + MicrosoftPublicKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -57,10 +57,14 @@ namespace Sunny.UI
|
|||||||
BackgroundLoop
|
BackgroundLoop
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SoundPlayer _SoundPlayer;
|
private static SoundPlayer _soundPlayer;
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 停止播放声音。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sound">SoundPlayer 对象。</param>
|
||||||
private static void InternalStop(SoundPlayer sound)
|
private static void InternalStop(SoundPlayer sound)
|
||||||
{
|
{
|
||||||
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
|
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert();
|
||||||
@ -74,60 +78,66 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>播放。wav声音文件。</summary>
|
/// <summary>
|
||||||
/// <param name="location">String,包含声音文件的名称 </param>
|
/// 播放 .wav 声音文件。
|
||||||
/// <PermissionSet><IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlThread" /><IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /></PermissionSet>
|
/// </summary>
|
||||||
|
/// <param name="location">包含声音文件的名称的字符串。</param>
|
||||||
public static void Play(string location)
|
public static void Play(string location)
|
||||||
{
|
{
|
||||||
Play(location, AudioPlayMode.Background);
|
Play(location, AudioPlayMode.Background);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 播放。wav声音文件.
|
/// 播放 .wav 声音文件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="location">AudioPlayMode枚举模式播放声音。默认情况下,AudioPlayMode.Background。</param>
|
/// <param name="location">包含声音文件的名称的字符串。</param>
|
||||||
/// <param name="playMode">String,包含声音文件的名称</param>
|
/// <param name="playMode">AudioPlayMode 枚举,指示播放模式。</param>
|
||||||
public static void Play(string location, AudioPlayMode playMode)
|
public static void Play(string location, AudioPlayMode playMode)
|
||||||
{
|
{
|
||||||
ValidateAudioPlayModeEnum(playMode, "playMode");
|
ValidateAudioPlayModeEnum(playMode, nameof(playMode));
|
||||||
string text1 = ValidateFilename(location);
|
var validatedLocation = ValidateFilename(location);
|
||||||
SoundPlayer player1 = new SoundPlayer(text1);
|
SoundPlayer player = new SoundPlayer(validatedLocation);
|
||||||
Play(player1, playMode);
|
Play(player, playMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据播放模式播放声音。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sound">SoundPlayer 对象。</param>
|
||||||
|
/// <param name="mode">AudioPlayMode 枚举,指示播放模式。</param>
|
||||||
private static void Play(SoundPlayer sound, AudioPlayMode mode)
|
private static void Play(SoundPlayer sound, AudioPlayMode mode)
|
||||||
{
|
{
|
||||||
if (_SoundPlayer != null)
|
if (_soundPlayer != null)
|
||||||
{
|
{
|
||||||
InternalStop(_SoundPlayer);
|
InternalStop(_soundPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
_SoundPlayer = sound;
|
_soundPlayer = sound;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case AudioPlayMode.WaitToComplete:
|
case AudioPlayMode.WaitToComplete:
|
||||||
_SoundPlayer.PlaySync();
|
_soundPlayer.PlaySync();
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case AudioPlayMode.Background:
|
case AudioPlayMode.Background:
|
||||||
_SoundPlayer.Play();
|
_soundPlayer.Play();
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case AudioPlayMode.BackgroundLoop:
|
case AudioPlayMode.BackgroundLoop:
|
||||||
_SoundPlayer.PlayLooping();
|
_soundPlayer.PlayLooping();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 播放系统声音。
|
/// 播放系统声音。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="systemSound">对象代表系统播放声音。</param>
|
/// <param name="systemSound">SystemSound 对象,代表系统播放声音。</param>
|
||||||
public static void PlaySystemSound(SystemSound systemSound)
|
public static void PlaySystemSound(SystemSound systemSound)
|
||||||
{
|
{
|
||||||
if (systemSound == null)
|
if (systemSound == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException(nameof(systemSound));
|
||||||
}
|
}
|
||||||
|
|
||||||
systemSound.Play();
|
systemSound.Play();
|
||||||
@ -136,26 +146,35 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止在后台播放声音。
|
/// 停止在后台播放声音。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <filterpriority>1</filterpriority>
|
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
SoundPlayer player1 = new SoundPlayer();
|
SoundPlayer player = new SoundPlayer();
|
||||||
InternalStop(player1);
|
InternalStop(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证 AudioPlayMode 枚举值。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">AudioPlayMode 枚举值。</param>
|
||||||
|
/// <param name="paramName">参数名称。</param>
|
||||||
private static void ValidateAudioPlayModeEnum(AudioPlayMode value, string paramName)
|
private static void ValidateAudioPlayModeEnum(AudioPlayMode value, string paramName)
|
||||||
{
|
{
|
||||||
if ((value < AudioPlayMode.WaitToComplete) || (value > AudioPlayMode.BackgroundLoop))
|
if (!Enum.IsDefined(typeof(AudioPlayMode), value))
|
||||||
{
|
{
|
||||||
throw new InvalidEnumArgumentException(paramName, (int)value, typeof(AudioPlayMode));
|
throw new InvalidEnumArgumentException(paramName, (int)value, typeof(AudioPlayMode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验证文件名。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="location">文件名字符串。</param>
|
||||||
|
/// <returns>验证后的文件名。</returns>
|
||||||
private static string ValidateFilename(string location)
|
private static string ValidateFilename(string location)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(location))
|
if (string.IsNullOrEmpty(location))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException(nameof(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
return location;
|
return location;
|
||||||
@ -170,18 +189,18 @@ namespace Sunny.UI
|
|||||||
public static class Mp3Player
|
public static class Mp3Player
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 播放
|
/// 播放 MP3 文件。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="MP3_FileName">文件名</param>
|
/// <param name="mp3FileName">文件名。</param>
|
||||||
/// <param name="Repeat">重复</param>
|
/// <param name="repeat">是否重复播放。</param>
|
||||||
public static void Play(string MP3_FileName, bool Repeat)
|
public static void Play(string mp3FileName, bool repeat)
|
||||||
{
|
{
|
||||||
Win32.WinMM.mciSendString("open \"" + MP3_FileName + "\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
|
Win32.WinMM.mciSendString($"open \"{mp3FileName}\" type mpegvideo alias MediaFile", null, 0, IntPtr.Zero);
|
||||||
Win32.WinMM.mciSendString("play MediaFile" + (Repeat ? " repeat" : string.Empty), null, 0, IntPtr.Zero);
|
Win32.WinMM.mciSendString($"play MediaFile{(repeat ? " repeat" : string.Empty)}", null, 0, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 暂停
|
/// 暂停播放。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Pause()
|
public static void Pause()
|
||||||
{
|
{
|
||||||
@ -189,7 +208,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止
|
/// 停止播放。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
{
|
{
|
||||||
|
743
SunnyUI/Common/UBaseConfig.cs
Normal file
743
SunnyUI/Common/UBaseConfig.cs
Normal file
@ -0,0 +1,743 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.Common.dll can be used for free under the MIT license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UBaseConfig.cs
|
||||||
|
* 文件说明: 配置文件基类
|
||||||
|
* 当前版本: V3.1
|
||||||
|
* 创建日期: 2020-01-01
|
||||||
|
*
|
||||||
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件基类
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
public abstract class BaseConfig<TConfig> where TConfig : BaseConfig<TConfig>, new()
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 实体对象
|
||||||
|
/// </summary>
|
||||||
|
protected static TConfig current;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件描述
|
||||||
|
/// </summary>
|
||||||
|
public static string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var fileanddesc = ConfigHelper.GetConfigFile<TConfig>();
|
||||||
|
return fileanddesc.Item2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件名
|
||||||
|
/// </summary>
|
||||||
|
public static string ConfigFile
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var fileanddesc = ConfigHelper.GetConfigFile<TConfig>();
|
||||||
|
return fileanddesc.Item1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前可执行文件路径,末尾包括\
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
private static string CurrentDir()
|
||||||
|
{
|
||||||
|
return Environment.CurrentDirectory.DealPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前实例。通过置空可以使其重新加载。
|
||||||
|
/// </summary>
|
||||||
|
public static TConfig Current
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (current != null)
|
||||||
|
{
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 现在没有对象,尝试加载,若返回null则实例化一个新的
|
||||||
|
current = CreateNew();
|
||||||
|
if (!current.Load(CurrentDir() + ConfigFile))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 根据配置,有可能不保存,直接返回默认
|
||||||
|
current.Save();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
set => current = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TConfig CreateNew()
|
||||||
|
{
|
||||||
|
TConfig config = new TConfig();
|
||||||
|
config.SetDefault();
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>保存到配置文件中去</summary>
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
Save(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载指定配置文件
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public bool Load()
|
||||||
|
{
|
||||||
|
return Load(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">字符串</param>
|
||||||
|
/// <returns>加密后字符串</returns>
|
||||||
|
public string Encrypt(string str)
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
var value = random.Next(100000, 999999);
|
||||||
|
string tmp = str + value.ToString();
|
||||||
|
return tmp.DesEncrypt();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 解密
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">字符串</param>
|
||||||
|
/// <returns>解密后字符串</returns>
|
||||||
|
public string Decrypt(string str)
|
||||||
|
{
|
||||||
|
string result = str.DesDecrypt();
|
||||||
|
return result.Left(result.Length - 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>加载指定配置文件</summary>
|
||||||
|
/// <param name="filename">文件名</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public abstract bool Load(string filename);
|
||||||
|
|
||||||
|
/// <summary>保存到配置文件中去</summary>
|
||||||
|
/// <param name="filename">文件名</param>
|
||||||
|
public abstract void Save(string filename);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置默认值
|
||||||
|
/// </summary>
|
||||||
|
public virtual void SetDefault()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略此属性的配置存储
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class MapperIgnoreAttribute : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略此属性的配置存储
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class IgnoreAttribute : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件帮助类
|
||||||
|
/// </summary>
|
||||||
|
public static class ConfigHelper
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 类型是否能够转为指定基类
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <param name="baseType">基类</param>
|
||||||
|
/// <returns>是否能够转为指定基类</returns>
|
||||||
|
public static bool As(this Type type, Type baseType)
|
||||||
|
{
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果基类是泛型定义
|
||||||
|
if (baseType.IsGenericTypeDefinition && type.IsGenericType && !type.IsGenericTypeDefinition)
|
||||||
|
{
|
||||||
|
type = type.GetGenericTypeDefinition();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == baseType)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseType.IsAssignableFrom(type))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rs = false;
|
||||||
|
|
||||||
|
// 接口
|
||||||
|
if (baseType.IsInterface)
|
||||||
|
{
|
||||||
|
if (type.GetInterface(baseType.FullName) != null)
|
||||||
|
{
|
||||||
|
rs = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
foreach (var e in type.GetInterfaces())
|
||||||
|
{
|
||||||
|
if (e.IsGenericType && baseType.IsGenericTypeDefinition ? e.GetGenericTypeDefinition() == baseType : e == baseType)
|
||||||
|
{
|
||||||
|
rs = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否子类时,支持只反射加载的程序集
|
||||||
|
if (!rs && type.Assembly.ReflectionOnly)
|
||||||
|
{
|
||||||
|
// 反射加载时,需要特殊处理接口
|
||||||
|
while (!rs && type != typeof(object))
|
||||||
|
{
|
||||||
|
if (type == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.FullName == baseType.FullName && type.AssemblyQualifiedName == baseType.AssemblyQualifiedName)
|
||||||
|
{
|
||||||
|
rs = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = type.BaseType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>是否泛型字典</summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>是否泛型字典</returns>
|
||||||
|
public static bool IsDictionary(this Type type) => type != null && type.IsGenericType && type.As(typeof(IDictionary<,>));
|
||||||
|
|
||||||
|
/// <summary>是否泛型列表</summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>是否泛型列表</returns>
|
||||||
|
public static bool IsList(this Type type)
|
||||||
|
{
|
||||||
|
return type != null && type.IsGenericType && type.As(typeof(IList<>));
|
||||||
|
//return Array.IndexOf(type.GetInterfaces(), typeof(IEnumerable)) > -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>获取成员绑定的显示名,优先DisplayName,然后Description</summary>
|
||||||
|
/// <param name="member">member</param>
|
||||||
|
/// <returns>显示名</returns>
|
||||||
|
public static string DisplayName(this PropertyInfo member)
|
||||||
|
{
|
||||||
|
var att = member.GetCustomAttribute<DisplayNameAttribute>();
|
||||||
|
if (att != null && !att.DisplayName.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
return att.DisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>获取成员绑定的显示名,优先DisplayName,然后Description</summary>
|
||||||
|
/// <param name="member">member</param>
|
||||||
|
/// <returns>显示名</returns>
|
||||||
|
public static string Description(this PropertyInfo member)
|
||||||
|
{
|
||||||
|
var att2 = member.GetCustomAttribute<DescriptionAttribute>();
|
||||||
|
if (att2 != null && !att2.Description.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
return att2.Description;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取需要的属性,删除忽略的属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>属性列表</returns>
|
||||||
|
public static List<PropertyInfo> GetNeedProperties(this Type type)
|
||||||
|
{
|
||||||
|
var list = type.GetProperties();
|
||||||
|
List<PropertyInfo> result = new List<PropertyInfo>();
|
||||||
|
foreach (var info in list)
|
||||||
|
{
|
||||||
|
if (info.GetCustomAttribute<XmlIgnoreAttribute>() != null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.GetCustomAttribute<ConfigIgnoreAttribute>() != null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.GetCustomAttribute<MapperIgnoreAttribute>() != null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.GetCustomAttribute<IgnoreAttribute>() != null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取配置文件路径
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
/// <returns>文件名</returns>
|
||||||
|
public static Tuple<string, string> GetConfigFile<TConfig>()
|
||||||
|
{
|
||||||
|
string filename;
|
||||||
|
string description = "配置文件";
|
||||||
|
var att = typeof(TConfig).GetCustomAttribute<ConfigFileAttribute>();
|
||||||
|
if (att == null || att.FileName.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
filename = $"{typeof(TConfig).Name}.cfg";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filename = att.FileName;
|
||||||
|
|
||||||
|
if (!att.Description.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
description = att.Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Tuple<string, string>(filename, description);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config">配置类</param>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
/// <returns>节点</returns>
|
||||||
|
/// <exception cref="ApplicationException">ApplicationException</exception>
|
||||||
|
public static ConcurrentDictionary<string, Ident> InitIdents<TConfig>(TConfig config)
|
||||||
|
{
|
||||||
|
ConcurrentDictionary<string, Ident> idents = new ConcurrentDictionary<string, Ident>();
|
||||||
|
var list = config.GetType().GetNeedProperties();
|
||||||
|
foreach (PropertyInfo info in list)
|
||||||
|
{
|
||||||
|
Ident ident = new Ident
|
||||||
|
{
|
||||||
|
Key = info.Name,
|
||||||
|
Show = true,
|
||||||
|
Description = info.Description(),
|
||||||
|
IsList = info.PropertyType.IsList()
|
||||||
|
};
|
||||||
|
|
||||||
|
var section = info.GetCustomAttribute<ConfigSectionAttribute>();
|
||||||
|
ident.Section = section != null ? section.Section : "";
|
||||||
|
|
||||||
|
var propertyatt = info.GetCustomAttribute<ConfigPropertyAttribute>();
|
||||||
|
ident.Caption = propertyatt != null ? propertyatt.Caption : "";
|
||||||
|
ident.Unit = propertyatt != null ? propertyatt.Unit : "";
|
||||||
|
ident.Description = propertyatt != null ? propertyatt.Description : "";
|
||||||
|
|
||||||
|
var indexatt = info.GetCustomAttribute<ConfigIndexAttribute>();
|
||||||
|
ident.Index = indexatt?.Index ?? short.MaxValue + idents.Count;
|
||||||
|
ident.Show = indexatt == null || indexatt.Show;
|
||||||
|
|
||||||
|
if (ident.Description.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
ident.Description = info.DisplayName() ?? info.Description();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ident.Description.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
ident.Description = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!idents.ContainsKey(ident.Key))
|
||||||
|
{
|
||||||
|
idents.TryAdd(ident.Key, ident);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return idents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型默认值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetType">类型</param>
|
||||||
|
/// <returns>默认值</returns>
|
||||||
|
public static object DefaultValue(Type targetType)
|
||||||
|
{
|
||||||
|
return targetType.IsValueType ? Activator.CreateInstance(targetType) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取对象数值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config">配置文件</param>
|
||||||
|
/// <param name="idents">节点</param>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
/// <exception cref="ApplicationException">ApplicationException</exception>
|
||||||
|
public static void LoadConfigValue<TConfig>(TConfig config, ConcurrentDictionary<string, Ident> idents)
|
||||||
|
{
|
||||||
|
var list = config.GetType().GetNeedProperties();
|
||||||
|
foreach (PropertyInfo info in list)
|
||||||
|
{
|
||||||
|
object defaultobj = info.GetValue(config, null);
|
||||||
|
Type type = info.PropertyType;
|
||||||
|
|
||||||
|
if (type == typeof(string))
|
||||||
|
{
|
||||||
|
object value = idents[info.Name].Value;
|
||||||
|
info.SetValue(config, Convert.ChangeType(value == null ? defaultobj : value, type), null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ConvertEx.CanConvent(type))
|
||||||
|
{
|
||||||
|
object value = ConvertEx.StringToObject(idents[info.Name].Value, type, defaultobj);
|
||||||
|
info.SetValue(config, Convert.ChangeType(value, type), null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.IsList())
|
||||||
|
{
|
||||||
|
Type[] genericTypes = type.GetGenericArguments();
|
||||||
|
if (genericTypes.Length != 1)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("转换出错: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type childtype = genericTypes[0];
|
||||||
|
Type typeDataList = typeof(List<>).MakeGenericType(childtype);
|
||||||
|
MethodInfo methodInfo = typeDataList.GetMethod("Add", BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
if (methodInfo == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
object listvalue = typeDataList.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, new object[] { });
|
||||||
|
|
||||||
|
foreach (string strvalue in idents[info.Name].Values)
|
||||||
|
{
|
||||||
|
if (childtype == typeof(string))
|
||||||
|
{
|
||||||
|
object value = strvalue;
|
||||||
|
methodInfo.Invoke(listvalue, new[] { value });
|
||||||
|
}
|
||||||
|
else if (ConvertEx.CanConvent(childtype))
|
||||||
|
{
|
||||||
|
object value = ConvertEx.StringToObject(strvalue, childtype, DefaultValue(childtype));
|
||||||
|
methodInfo.Invoke(listvalue, new[] { value });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
info.SetValue(config, listvalue, null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置对象数值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config">配置文件</param>
|
||||||
|
/// <param name="idents">节点</param>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
/// <exception cref="ApplicationException">ApplicationException</exception>
|
||||||
|
public static void SaveConfigValue<TConfig>(TConfig config, ConcurrentDictionary<string, Ident> idents)
|
||||||
|
{
|
||||||
|
var list = config.GetType().GetNeedProperties();
|
||||||
|
foreach (PropertyInfo info in list)
|
||||||
|
{
|
||||||
|
object obj = info.GetValue(config, null);
|
||||||
|
Type type = info.PropertyType;
|
||||||
|
|
||||||
|
if (ConvertEx.CanConvent(type))
|
||||||
|
{
|
||||||
|
string value = ConvertEx.ObjectToString(obj, type);
|
||||||
|
idents[info.Name].Value = value;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.IsList())
|
||||||
|
{
|
||||||
|
Type[] genericTypes = type.GetGenericArguments();
|
||||||
|
if (genericTypes.Length != 1)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("转换出错: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type childtype = genericTypes[0];
|
||||||
|
IEnumerable en = obj as IEnumerable;
|
||||||
|
if (en == null)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("转换出错: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
idents[info.Name].Values.Clear();
|
||||||
|
foreach (object child in en)
|
||||||
|
{
|
||||||
|
if (ConvertEx.CanConvent(childtype))
|
||||||
|
{
|
||||||
|
idents[info.Name].Values.Add(ConvertEx.ObjectToString(child, childtype));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>配置文件特性</summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
|
public class ConfigFileAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件名
|
||||||
|
/// </summary>
|
||||||
|
public string FileName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件
|
||||||
|
/// </summary>
|
||||||
|
public ConfigFileAttribute() : this(string.Empty, string.Empty)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>配置文件</summary>
|
||||||
|
/// <param name="fileName">文件名</param>
|
||||||
|
/// <param name="description">描述</param>
|
||||||
|
public ConfigFileAttribute(string fileName, string description = "")
|
||||||
|
{
|
||||||
|
FileName = fileName;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据节点
|
||||||
|
/// </summary>
|
||||||
|
public class Ident
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 节
|
||||||
|
/// </summary>
|
||||||
|
public string Section { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 键
|
||||||
|
/// </summary>
|
||||||
|
public string Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 值
|
||||||
|
/// </summary>
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string Caption { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
public string Unit { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int Index { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示
|
||||||
|
/// </summary>
|
||||||
|
public bool Show { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ToString()
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>String</returns>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Index + " [" + Section + "] " + Key + " = ?";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是列表类型
|
||||||
|
/// </summary>
|
||||||
|
public bool IsList { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 列表值
|
||||||
|
/// </summary>
|
||||||
|
public List<string> Values = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置属性节点特性
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ConfigSectionAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 节
|
||||||
|
/// </summary>
|
||||||
|
public string Section { get; }
|
||||||
|
|
||||||
|
/// <summary>属性节点特性</summary>
|
||||||
|
/// <param name="section">节</param>
|
||||||
|
public ConfigSectionAttribute(string section)
|
||||||
|
{
|
||||||
|
Section = section;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置属性描述特性
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ConfigPropertyAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标题
|
||||||
|
/// </summary>
|
||||||
|
public string Caption { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位
|
||||||
|
/// </summary>
|
||||||
|
public string Unit { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置文件属性
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="caption">标题</param>
|
||||||
|
/// <param name="unit">单位</param>
|
||||||
|
/// <param name="description">描述</param>
|
||||||
|
public ConfigPropertyAttribute(string caption, string description = "", string unit = "")
|
||||||
|
{
|
||||||
|
Caption = caption;
|
||||||
|
Unit = unit;
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略此属性的配置存储
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ConfigIgnoreAttribute : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配置序号描述特性
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ConfigIndexAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int Index { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否显示
|
||||||
|
/// </summary>
|
||||||
|
public bool Show { get; }
|
||||||
|
|
||||||
|
/// <summary>配置序号特性</summary>
|
||||||
|
/// <param name="index">序号</param>
|
||||||
|
/// <param name="show">是否显示</param>
|
||||||
|
public ConfigIndexAttribute(int index, bool show = true)
|
||||||
|
{
|
||||||
|
Index = index;
|
||||||
|
Show = show;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -153,20 +153,16 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BmpFile
|
public class BmpFile
|
||||||
{
|
{
|
||||||
BmpHead head;
|
|
||||||
|
|
||||||
byte[] data;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 慢于 bitmap.Save(XX,ImageFormat.Bmp),只是为了解释BMP文件数据格式
|
/// 慢于 bitmap.Save(XX,ImageFormat.Bmp),只是为了解释BMP文件数据格式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bitmap"></param>
|
/// <param name="bitmap"></param>
|
||||||
public BmpFile(Bitmap bitmap)
|
public BmpFile(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
head = new BmpHead();
|
var head = new BmpHead();
|
||||||
head.Init(bitmap);
|
head.Init(bitmap);
|
||||||
data = new byte[head.FileSize];
|
Data = new byte[head.FileSize];
|
||||||
Array.Copy(head.ToBytes(), 0, data, 0, (int)head.BitmapDataOffset);
|
Array.Copy(head.ToBytes(), 0, Data, 0, (int)head.BitmapDataOffset);
|
||||||
|
|
||||||
var sourceArea = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
|
var sourceArea = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
|
||||||
var bitmapData = bitmap.LockBits(sourceArea, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
|
var bitmapData = bitmap.LockBits(sourceArea, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
|
||||||
@ -200,10 +196,10 @@ namespace Sunny.UI
|
|||||||
/// <param name="bmpData">数据,从左上角开始,为每个点的B、G、R循环</param>
|
/// <param name="bmpData">数据,从左上角开始,为每个点的B、G、R循环</param>
|
||||||
public BmpFile(int width, int height, byte[] bmpData)
|
public BmpFile(int width, int height, byte[] bmpData)
|
||||||
{
|
{
|
||||||
head = new BmpHead();
|
var head = new BmpHead();
|
||||||
head.Init(width, height);
|
head.Init(width, height);
|
||||||
data = new byte[head.FileSize];
|
Data = new byte[head.FileSize];
|
||||||
Array.Copy(head.ToBytes(), 0, data, 0, (int)head.BitmapDataOffset);
|
Array.Copy(head.ToBytes(), 0, Data, 0, (int)head.BitmapDataOffset);
|
||||||
if (bmpData.Length != width * height * 3) return;
|
if (bmpData.Length != width * height * 3) return;
|
||||||
|
|
||||||
//BMP文件的数据从左下角开始,每行向上。System.Drawing.Bitmap数据是从左上角开始,每行向下
|
//BMP文件的数据从左下角开始,每行向上。System.Drawing.Bitmap数据是从左上角开始,每行向下
|
||||||
@ -212,7 +208,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
int offset = height - 1 - i;
|
int offset = height - 1 - i;
|
||||||
offset *= width * 3;
|
offset *= width * 3;
|
||||||
Array.Copy(bmpData, offset, data, idx, width * 3);
|
Array.Copy(bmpData, offset, Data, idx, width * 3);
|
||||||
idx += width * 3;
|
idx += width * 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +216,7 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 二进制数据
|
/// 二进制数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Data => data;
|
public byte[] Data { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存文件
|
/// 保存文件
|
||||||
@ -228,7 +224,7 @@ namespace Sunny.UI
|
|||||||
/// <param name="fileName">文件名</param>
|
/// <param name="fileName">文件名</param>
|
||||||
public void SaveToFile(string fileName)
|
public void SaveToFile(string fileName)
|
||||||
{
|
{
|
||||||
File.WriteAllBytes(fileName, data);
|
File.WriteAllBytes(fileName, Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -237,7 +233,7 @@ namespace Sunny.UI
|
|||||||
/// <returns>图片</returns>
|
/// <returns>图片</returns>
|
||||||
public Bitmap Bitmap()
|
public Bitmap Bitmap()
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream(data);
|
var ms = new MemoryStream(Data);
|
||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
return new Bitmap(ms);
|
return new Bitmap(ms);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -18,6 +18,7 @@
|
|||||||
*
|
*
|
||||||
* 2020-01-01: V2.2.0 增加文件说明
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
* 2023-04-02: V3.3.4 修复关闭弹窗null的Bug
|
* 2023-04-02: V3.3.4 修复关闭弹窗null的Bug
|
||||||
|
* 2024-11-06: V3.7.2 UITreeView增加了一个刷新节点状态的扩展函数
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -530,32 +531,38 @@ namespace Sunny.UI
|
|||||||
/// <returns>全选状态(Checked),半选状态(Indeterminate),未选状态(Unchecked)</returns>
|
/// <returns>全选状态(Checked),半选状态(Indeterminate),未选状态(Unchecked)</returns>
|
||||||
public static CheckState CheckState(this TreeNode node)
|
public static CheckState CheckState(this TreeNode node)
|
||||||
{
|
{
|
||||||
if (GetChildNodeCheckedState(node))
|
if (node.Nodes.Count > 0)
|
||||||
{
|
{
|
||||||
return System.Windows.Forms.CheckState.Indeterminate;
|
var count = node.Nodes.Cast<TreeNode>().Where(n => n.Checked).ToList().Count;
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
return System.Windows.Forms.CheckState.Unchecked;
|
||||||
|
}
|
||||||
|
else if (count == node.Nodes.Count)
|
||||||
|
{
|
||||||
|
return System.Windows.Forms.CheckState.Checked;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return System.Windows.Forms.CheckState.Indeterminate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return node.Checked ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked;
|
return node.Checked ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool GetChildNodeCheckedState(TreeNode node)
|
public static void RefreshCheckState(this TreeNode node)
|
||||||
{
|
{
|
||||||
|
if (node.TreeView is not UITreeView.TreeViewEx tv) return;
|
||||||
|
System.Windows.Forms.CheckState state = node.CheckState();
|
||||||
if (node.Nodes.Count > 0)
|
if (node.Nodes.Count > 0)
|
||||||
{
|
{
|
||||||
var count = node.Nodes.Cast<TreeNode>().Where(n => n.Checked).ToList().Count;
|
if (state == System.Windows.Forms.CheckState.Checked && !node.Checked) node.Checked = true;
|
||||||
if (count > 0 && count < node.Nodes.Count)
|
if (state == System.Windows.Forms.CheckState.Unchecked && node.Checked) node.Checked = false;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (TreeNode nd in node.Nodes)
|
|
||||||
{
|
|
||||||
return GetChildNodeCheckedState(nd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
tv.DicNodeStatus[node.GetHashCode()] = state == System.Windows.Forms.CheckState.Indeterminate;
|
||||||
|
tv.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Disabled(this Control ctrl)
|
public static void Disabled(this Control ctrl)
|
||||||
|
371
SunnyUI/Common/UConvertEx.cs
Normal file
371
SunnyUI/Common/UConvertEx.cs
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.Common.dll can be used for free under the MIT license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UConvertEx.cs
|
||||||
|
* 文件说明: 对象转换扩展类
|
||||||
|
* 当前版本: V3.1
|
||||||
|
* 创建日期: 2020-01-01
|
||||||
|
*
|
||||||
|
* 2020-11-20: V3.0.0 增加文件说明
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 对象转换扩展类
|
||||||
|
/// </summary>
|
||||||
|
public static class ConvertEx
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 可以对象和字符串互相转换的类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public static bool CanConvent(Type type)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
TypeCode typeCode = Type.GetTypeCode(type);
|
||||||
|
switch (typeCode)
|
||||||
|
{
|
||||||
|
case TypeCode.String:
|
||||||
|
case TypeCode.Char:
|
||||||
|
case TypeCode.SByte:
|
||||||
|
case TypeCode.Byte:
|
||||||
|
case TypeCode.Int16:
|
||||||
|
case TypeCode.UInt16:
|
||||||
|
case TypeCode.Int32:
|
||||||
|
case TypeCode.UInt32:
|
||||||
|
case TypeCode.Int64:
|
||||||
|
case TypeCode.UInt64:
|
||||||
|
case TypeCode.Single:
|
||||||
|
case TypeCode.Double:
|
||||||
|
case TypeCode.Decimal:
|
||||||
|
case TypeCode.Boolean:
|
||||||
|
case TypeCode.DateTime:
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Object:
|
||||||
|
if (type == typeof(Point) ||
|
||||||
|
type == typeof(PointF) ||
|
||||||
|
type == typeof(Color) ||
|
||||||
|
type == typeof(Size) ||
|
||||||
|
type == typeof(SizeF))
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">字符串</param>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <param name="defaultobj">默认对象</param>
|
||||||
|
/// <returns>对象</returns>
|
||||||
|
public static object StringToObject(string str, Type type, object defaultobj)
|
||||||
|
{
|
||||||
|
object obj = defaultobj;
|
||||||
|
|
||||||
|
if (type == typeof(string))
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
return defaultobj;
|
||||||
|
}
|
||||||
|
|
||||||
|
TypeCode typeCode = Type.GetTypeCode(type);
|
||||||
|
switch (typeCode)
|
||||||
|
{
|
||||||
|
case TypeCode.Char:
|
||||||
|
obj = str.ToChar((char)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.SByte:
|
||||||
|
obj = str.ToSByte((sbyte)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Byte:
|
||||||
|
obj = str.ToByte((byte)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Int16:
|
||||||
|
obj = str.ToShort((short)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.UInt16:
|
||||||
|
obj = str.ToUShort((ushort)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Int32:
|
||||||
|
obj = str.ToInt((int)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.UInt32:
|
||||||
|
obj = str.ToUInt((uint)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Int64:
|
||||||
|
obj = str.ToLong((long)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.UInt64:
|
||||||
|
obj = str.ToULong((ulong)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Single:
|
||||||
|
obj = str.ToFloat((float)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Double:
|
||||||
|
obj = str.ToDouble((double)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Decimal:
|
||||||
|
obj = str.ToDecimal((decimal)defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Boolean:
|
||||||
|
if (str.ToUpper().Equals(bool.TrueString.ToUpper()))
|
||||||
|
{
|
||||||
|
obj = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str.ToUpper().Equals(bool.FalseString.ToUpper()))
|
||||||
|
{
|
||||||
|
obj = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.DateTime:
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime dt = str.ToDateTime(DateTimeEx.DateTimeFormat);
|
||||||
|
obj = dt;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Object:
|
||||||
|
obj = StringToObjectEx(str, type, defaultobj);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == typeof(DateTime))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转对象扩展
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">字符串</param>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <param name="defaultobj">默认对象</param>
|
||||||
|
/// <returns>对象</returns>
|
||||||
|
private static object StringToObjectEx(string str, Type type, object defaultobj)
|
||||||
|
{
|
||||||
|
object obj = defaultobj;
|
||||||
|
|
||||||
|
if (type == typeof(Point))
|
||||||
|
{
|
||||||
|
string[] strs = str.ToUpper().Replace("X:", "").Replace("Y:", "").Trim().Split(";");
|
||||||
|
|
||||||
|
if (strs.Length == 2)
|
||||||
|
{
|
||||||
|
if (int.TryParse(strs[0], out var x) && int.TryParse(strs[1], out var y))
|
||||||
|
{
|
||||||
|
obj = new Point(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == typeof(PointF))
|
||||||
|
{
|
||||||
|
string[] strs = str.ToUpper().Replace("X:", "").Replace("Y:", "").Trim().Split(";");
|
||||||
|
|
||||||
|
if (strs.Length == 2)
|
||||||
|
{
|
||||||
|
if (float.TryParse(strs[0], out var x) && float.TryParse(strs[1], out var y))
|
||||||
|
{
|
||||||
|
obj = new PointF(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == typeof(Color))
|
||||||
|
{
|
||||||
|
string[] strs = str.ToUpper().Replace("A:", "").Replace("R:", "").Replace("G:", "").Replace("B:", "").Trim().Split(";");
|
||||||
|
|
||||||
|
if (strs.Length == 4)
|
||||||
|
{
|
||||||
|
if (int.TryParse(strs[0], out var a) && int.TryParse(strs[1], out var r) && int.TryParse(strs[2], out var g) && int.TryParse(strs[3], out var b))
|
||||||
|
{
|
||||||
|
if (a.InRange(0, 255) && r.InRange(0, 255) && g.InRange(0, 255) && b.InRange(0, 255))
|
||||||
|
{
|
||||||
|
obj = Color.FromArgb(a, r, g, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == typeof(Size))
|
||||||
|
{
|
||||||
|
string[] strs = str.ToUpper().Replace("W:", "").Replace("H:", "").Trim().Split(";");
|
||||||
|
|
||||||
|
if (strs.Length == 2)
|
||||||
|
{
|
||||||
|
if (int.TryParse(strs[0], out var x) && int.TryParse(strs[1], out var y))
|
||||||
|
{
|
||||||
|
obj = new Size(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (type == typeof(SizeF))
|
||||||
|
{
|
||||||
|
string[] strs = str.ToUpper().Replace("W:", "").Replace("H:", "").Trim().Split(";");
|
||||||
|
|
||||||
|
if (strs.Length == 2)
|
||||||
|
{
|
||||||
|
if (float.TryParse(strs[0], out var x) && float.TryParse(strs[1], out var y))
|
||||||
|
{
|
||||||
|
obj = new SizeF(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 对象转字符串
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">对象</param>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>字符串</returns>
|
||||||
|
public static string ObjectToString(object obj, Type type)
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
|
||||||
|
TypeCode typeCode = Type.GetTypeCode(type);
|
||||||
|
switch (typeCode)
|
||||||
|
{
|
||||||
|
case TypeCode.String:
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
obj = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
value = obj.ToString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Char:
|
||||||
|
case TypeCode.SByte:
|
||||||
|
case TypeCode.Byte:
|
||||||
|
case TypeCode.Int16:
|
||||||
|
case TypeCode.UInt16:
|
||||||
|
case TypeCode.Int32:
|
||||||
|
case TypeCode.UInt32:
|
||||||
|
case TypeCode.Int64:
|
||||||
|
case TypeCode.UInt64:
|
||||||
|
case TypeCode.Single:
|
||||||
|
case TypeCode.Double:
|
||||||
|
case TypeCode.Decimal:
|
||||||
|
value = obj.ToString();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Boolean:
|
||||||
|
value = (bool)obj ? bool.TrueString : bool.FalseString;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.DateTime:
|
||||||
|
value = ((DateTime)obj).ToString(DateTimeEx.DateTimeFormat);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TypeCode.Object:
|
||||||
|
value = ObjectToStringEx(obj, type);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 对象转字符串扩展
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj">对象</param>
|
||||||
|
/// <param name="type">类型</param>
|
||||||
|
/// <returns>字符串</returns>
|
||||||
|
private static string ObjectToStringEx(object obj, Type type)
|
||||||
|
{
|
||||||
|
string value;
|
||||||
|
|
||||||
|
if (type == typeof(Point))
|
||||||
|
{
|
||||||
|
Point point = (Point)obj;
|
||||||
|
value = "X:" + point.X + "; Y:" + point.Y;
|
||||||
|
}
|
||||||
|
else if (type == typeof(PointF))
|
||||||
|
{
|
||||||
|
PointF point = (PointF)obj;
|
||||||
|
value = "X:" + point.X + "; Y:" + point.Y;
|
||||||
|
}
|
||||||
|
else if (type == typeof(Color))
|
||||||
|
{
|
||||||
|
Color color = (Color)obj;
|
||||||
|
value = "A:" + color.A + "; R:" + color.R + "; G:" + color.G + "; B:" + color.B;
|
||||||
|
}
|
||||||
|
else if (type == typeof(Size))
|
||||||
|
{
|
||||||
|
Size size = (Size)obj;
|
||||||
|
value = "W:" + size.Width + "; H:" + size.Height;
|
||||||
|
}
|
||||||
|
else if (type == typeof(SizeF))
|
||||||
|
{
|
||||||
|
SizeF size = (SizeF)obj;
|
||||||
|
value = "W:" + size.Width + "; H:" + size.Height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ApplicationException("不支持此类型: " + type.FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
382
SunnyUI/Common/UDateTimeInt64.cs
Normal file
382
SunnyUI/Common/UDateTimeInt64.cs
Normal file
@ -0,0 +1,382 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UDateTimeInt64.cs
|
||||||
|
* 文件说明: 日期长整型
|
||||||
|
* 当前版本: V2.2
|
||||||
|
* 创建日期: 2020-09-23
|
||||||
|
*
|
||||||
|
* 2020-09-23: V2.2.8 增加文件说明
|
||||||
|
* 2020-10-10: V2.2.8 增加与Double互转
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 日期与长整形和浮点型互转
|
||||||
|
/// Value:长整形,为1970年1月1日0时起的毫秒数
|
||||||
|
/// DoubleValue:双精度浮点数,1970年1月1日0时起的天数
|
||||||
|
/// </summary>
|
||||||
|
public struct DateTimeInt64 : IComparable, IEquatable<DateTimeInt64>, IEquatable<long>, IEquatable<DateTime>
|
||||||
|
{
|
||||||
|
public long Value { get; set; }
|
||||||
|
|
||||||
|
public const long Jan1st1970Ticks = 621355968000000000; //Jan1st1970.Ticks;
|
||||||
|
public const long Dec31th9999Ticks = 3155378975999990000; //DateTime.MaxValue.Ticks;
|
||||||
|
public const string DefaultFormatString = DateTimeEx.DateTimeFormatEx;
|
||||||
|
public const double MillisecondsPerDay = 86400000.0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回当前时间的毫秒数, 这个毫秒其实就是自1970年1月1日0时起的毫秒数
|
||||||
|
/// </summary>
|
||||||
|
public static long CurrentDateTimeToTicks()
|
||||||
|
{
|
||||||
|
return (DateTime.UtcNow.Ticks - Jan1st1970Ticks) / 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double DoubleValue
|
||||||
|
{
|
||||||
|
get { return Value * 1.0 / MillisecondsPerDay; }
|
||||||
|
set { Value = (long)(value * MillisecondsPerDay); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回指定时间的毫秒数, 这个毫秒其实就是自1970年1月1日0时起的毫秒数
|
||||||
|
/// </summary>
|
||||||
|
public static long DateTimeToTicks(DateTime datetime)
|
||||||
|
{
|
||||||
|
return (datetime.ToUniversalTime().Ticks - Jan1st1970Ticks) / 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从一个代表自1970年1月1日0时起的毫秒数,转换为DateTime (北京时间)
|
||||||
|
/// </summary>
|
||||||
|
public static DateTime TicksToDateTime(long ticks)
|
||||||
|
{
|
||||||
|
#pragma warning disable CS0618 // 类型或成员已过时
|
||||||
|
return TimeZone.CurrentTimeZone.ToLocalTime(TicksToUTCDateTime(ticks));
|
||||||
|
#pragma warning restore CS0618 // 类型或成员已过时
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 从一个代表自1970年1月1日0时起的毫秒数,转换为DateTime (UTC时间)
|
||||||
|
/// </summary>
|
||||||
|
public static DateTime TicksToUTCDateTime(long ticks)
|
||||||
|
{
|
||||||
|
return new DateTime(ticks * 10000 + Jan1st1970Ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(long ticks)
|
||||||
|
{
|
||||||
|
ticks = MakeValidDate(ticks);
|
||||||
|
Value = ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(double doubleTicks)
|
||||||
|
{
|
||||||
|
doubleTicks = MakeValidDate((long)(doubleTicks * MillisecondsPerDay));
|
||||||
|
Value = (long)doubleTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(DateTime dateTime)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(dateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(int year, int month, int day)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(new DateTime(year, month, day));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(int year, int month, int day, int hour, int minute, int second)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(new DateTime(year, month, day, hour, minute, second));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(int year, int month, int day, int hour, int minute, int second, int millisecond)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(new DateTime(year, month, day, hour, minute, second, millisecond));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTimeInt64(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
Value = dtValue.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsValidDate
|
||||||
|
{
|
||||||
|
get { return Value >= 0 && Value <= Dec31th9999Ticks - Jan1st1970Ticks; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime DateTime
|
||||||
|
{
|
||||||
|
get { return TicksToDateTime(Value); }
|
||||||
|
set { Value = DateTimeToTicks(value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CheckValidDate(long ticks)
|
||||||
|
{
|
||||||
|
return ticks >= 0 && ticks <= Dec31th9999Ticks - Jan1st1970Ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long MakeValidDate(long ticks)
|
||||||
|
{
|
||||||
|
if (ticks < 0)
|
||||||
|
ticks = 0;
|
||||||
|
if (ticks > Dec31th9999Ticks - Jan1st1970Ticks)
|
||||||
|
ticks = Dec31th9999Ticks - Jan1st1970Ticks;
|
||||||
|
|
||||||
|
return ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddMilliseconds(double milliseconds)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddMilliseconds(milliseconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddSeconds(double seconds)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddSeconds(seconds));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddMinutes(double minutes)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddMinutes(minutes));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddHours(double hours)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddHours(hours));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddDays(double days)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddDays(days));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddMonths(int months)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddMonths(months));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddYears(int years)
|
||||||
|
{
|
||||||
|
Value = DateTimeToTicks(DateTime.AddYears(years));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long operator -(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value - dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long operator +(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value + dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTimeInt64 operator -(DateTimeInt64 dtValue1, long dtValue2)
|
||||||
|
{
|
||||||
|
dtValue1.Value -= dtValue2;
|
||||||
|
return dtValue1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTimeInt64 operator +(DateTimeInt64 dtValue1, long dtValue2)
|
||||||
|
{
|
||||||
|
dtValue1.Value += dtValue2;
|
||||||
|
return dtValue1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTimeInt64 operator ++(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
dtValue.AddDays(1);
|
||||||
|
return dtValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateTimeInt64 operator --(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
dtValue.AddDays(-1);
|
||||||
|
return dtValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator long(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
return dtValue.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator DateTimeInt64(long ticks)
|
||||||
|
{
|
||||||
|
return new DateTimeInt64(ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator DateTimeInt64(DateTime dt)
|
||||||
|
{
|
||||||
|
return new DateTimeInt64(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator DateTime(DateTimeInt64 dt)
|
||||||
|
{
|
||||||
|
return dt.DateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator double(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
return dtValue.DoubleValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator DateTimeInt64(double ticks)
|
||||||
|
{
|
||||||
|
return new DateTimeInt64(ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator ==(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value == dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value != dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator ==(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value == ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value != ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value < dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value > dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <=(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value <= dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >=(DateTimeInt64 dtValue1, DateTimeInt64 dtValue2)
|
||||||
|
{
|
||||||
|
return dtValue1.Value >= dtValue2.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value < ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value > ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <=(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value <= ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >=(DateTimeInt64 dtValue, long ticks)
|
||||||
|
{
|
||||||
|
return dtValue.Value >= ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
return dtValue.Value == Value;
|
||||||
|
}
|
||||||
|
else if (obj is long longValue)
|
||||||
|
{
|
||||||
|
return longValue == Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Value.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
int IComparable.CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (!(obj is DateTimeInt64)) throw new ArgumentException();
|
||||||
|
return (Value).CompareTo(((DateTimeInt64)obj).Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ToString(long ticks)
|
||||||
|
{
|
||||||
|
return ToString(ticks, DefaultFormatString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ToString(Value, DefaultFormatString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ToString(string fmtStr)
|
||||||
|
{
|
||||||
|
return ToString(Value, fmtStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToString(long dtValue, string fmtStr)
|
||||||
|
{
|
||||||
|
DateTime dt = TicksToDateTime(dtValue);
|
||||||
|
return dt.ToString(fmtStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(DateTimeInt64 dtValue)
|
||||||
|
{
|
||||||
|
return Value == dtValue.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(long ticks)
|
||||||
|
{
|
||||||
|
return Value == ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(DateTime datetime)
|
||||||
|
{
|
||||||
|
return Value == (new DateTimeInt64(datetime)).Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DateTimeString => DateTime.DateTimeString();
|
||||||
|
|
||||||
|
public string DateString => DateTime.DateString();
|
||||||
|
|
||||||
|
public string TimeString => DateTime.TimeString();
|
||||||
|
|
||||||
|
public string HourMinuteString => DateTime.ToString("HH:mm");
|
||||||
|
|
||||||
|
public int Year => DateTime.Year;
|
||||||
|
public int Month => DateTime.Month;
|
||||||
|
public int Day => DateTime.Day;
|
||||||
|
public int Hour => DateTime.Hour;
|
||||||
|
public int Minute => DateTime.Minute;
|
||||||
|
public int Second => DateTime.Second;
|
||||||
|
public int Millisecond => DateTime.Millisecond;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -382,7 +382,6 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建圆角路径
|
/// 创建圆角路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g">绘图图面</param>
|
|
||||||
/// <param name="rect">区域</param>
|
/// <param name="rect">区域</param>
|
||||||
/// <param name="radius">圆角大小</param>
|
/// <param name="radius">圆角大小</param>
|
||||||
/// <param name="cornerLeftTop">左上角</param>
|
/// <param name="cornerLeftTop">左上角</param>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -33,6 +33,70 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class GraphicsEx
|
public static class GraphicsEx
|
||||||
{
|
{
|
||||||
|
public static string TruncateText(Graphics graphics, string text, Font font, float maxWidth)
|
||||||
|
{
|
||||||
|
// If the text is empty or null, return it as-is.
|
||||||
|
if (string.IsNullOrEmpty(text)) return text;
|
||||||
|
|
||||||
|
// Measure the original string.
|
||||||
|
SizeF size = graphics.MeasureString(text, font);
|
||||||
|
|
||||||
|
// If the original string fits within the width, return it as-is.
|
||||||
|
if (size.Width <= maxWidth) return text;
|
||||||
|
|
||||||
|
// Otherwise, truncate the string until it fits.
|
||||||
|
string truncatedText = text;
|
||||||
|
for (int i = text.Length; i > 0; i--)
|
||||||
|
{
|
||||||
|
truncatedText = text.Left(i) + "...";
|
||||||
|
size = graphics.MeasureString(truncatedText, font);
|
||||||
|
if (size.Width <= maxWidth)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return truncatedText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawTruncateString(this Graphics g, string text, Font font, Color color, Rectangle rect, float maxWidth, HorizontalAlignment alignment)
|
||||||
|
{
|
||||||
|
text = TruncateText(g, text, font, maxWidth);
|
||||||
|
g.DrawString(text, font, color, rect, alignment.ToContentAlignment());
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static ContentAlignment ToContentAlignment(this HorizontalAlignment alignment)
|
||||||
|
{
|
||||||
|
switch (alignment)
|
||||||
|
{
|
||||||
|
case HorizontalAlignment.Left: return ContentAlignment.MiddleLeft;
|
||||||
|
case HorizontalAlignment.Center: return ContentAlignment.MiddleCenter;
|
||||||
|
case HorizontalAlignment.Right: return ContentAlignment.MiddleRight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ContentAlignment.MiddleLeft;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static HorizontalAlignment ToHorizontalAlignment(this ContentAlignment alignment)
|
||||||
|
{
|
||||||
|
switch (alignment)
|
||||||
|
{
|
||||||
|
case ContentAlignment.TopLeft:
|
||||||
|
case ContentAlignment.MiddleLeft:
|
||||||
|
case ContentAlignment.BottomLeft:
|
||||||
|
return HorizontalAlignment.Left;
|
||||||
|
case ContentAlignment.TopCenter:
|
||||||
|
case ContentAlignment.MiddleCenter:
|
||||||
|
case ContentAlignment.BottomCenter:
|
||||||
|
return HorizontalAlignment.Center;
|
||||||
|
case ContentAlignment.TopRight:
|
||||||
|
case ContentAlignment.MiddleRight:
|
||||||
|
case ContentAlignment.BottomRight:
|
||||||
|
return HorizontalAlignment.Right;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HorizontalAlignment.Left;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void DrawString(this Graphics g, string text, Font font, Color color, Rectangle rect, ContentAlignment alignment, int offsetX = 0, int offsetY = 0)
|
public static void DrawString(this Graphics g, string text, Font font, Color color, Rectangle rect, ContentAlignment alignment, int offsetX = 0, int offsetY = 0)
|
||||||
{
|
{
|
||||||
if (text.IsNullOrEmpty()) return;
|
if (text.IsNullOrEmpty()) return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -22,7 +22,6 @@
|
|||||||
* 2023-08-11: v3.4.1 增加了文件绝对路径判断和文件夹是否存在判断
|
* 2023-08-11: v3.4.1 增加了文件绝对路径判断和文件夹是否存在判断
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using Sunny.UI.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -31,6 +30,7 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Sunny.UI.Win32;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
@ -299,29 +299,6 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class IniFile : IniBase
|
public class IniFile : IniBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 写Byte数组
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">section</param>
|
|
||||||
/// <param name="key">key</param>
|
|
||||||
/// <param name="value">value</param>
|
|
||||||
public void Write(string section, string key, byte[] value)
|
|
||||||
{
|
|
||||||
Write(section, key, value.ToHexString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 读Byte数组
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="section">section</param>
|
|
||||||
/// <param name="key">key</param>
|
|
||||||
/// <param name="Default">Normal</param>
|
|
||||||
/// <returns>结果</returns>
|
|
||||||
public byte[] ReadBytes(string section, string key, byte[] Default)
|
|
||||||
{
|
|
||||||
return Read(section, key, Default.ToHexString()).ToHexBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写Char
|
/// 写Char
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
790
SunnyUI/Common/UIniFileEx.cs
Normal file
790
SunnyUI/Common/UIniFileEx.cs
Normal file
@ -0,0 +1,790 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UIniFileEx.cs
|
||||||
|
* 文件说明: INI 文件读取类(不用WinAPI)
|
||||||
|
* 当前版本: V3.1
|
||||||
|
* 创建日期: 2021-10-27
|
||||||
|
*
|
||||||
|
* 2021-10-27: V2.2.0 增加文件说明
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
public class IniFileEx
|
||||||
|
{
|
||||||
|
private readonly Dictionary<string, NameValueCollection> data = new Dictionary<string, NameValueCollection>();
|
||||||
|
|
||||||
|
private static readonly Regex regRemoveEmptyLines =
|
||||||
|
new Regex
|
||||||
|
(
|
||||||
|
@"(\s*;[\d\D]*?\r?\n)+|\r?\n(\s*\r?\n)*",
|
||||||
|
RegexOptions.Multiline | RegexOptions.Compiled
|
||||||
|
);
|
||||||
|
|
||||||
|
private static readonly Regex regParseIniData =
|
||||||
|
new Regex
|
||||||
|
(
|
||||||
|
@"
|
||||||
|
(?<IsSection>
|
||||||
|
^\s*\[(?<SectionName>[^\]]+)?\]\s*$
|
||||||
|
)
|
||||||
|
|
|
||||||
|
(?<IsKeyValue>
|
||||||
|
^\s*(?<Key>[^(\s*\=\s*)]+)?\s*\=\s*(?<Value>[\d\D]*)$
|
||||||
|
)",
|
||||||
|
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace
|
||||||
|
);
|
||||||
|
|
||||||
|
public IniFileEx(string fileName) : this(fileName, Encoding.Default) { }
|
||||||
|
|
||||||
|
public IniFileEx(string fileName, Encoding encoding)
|
||||||
|
{
|
||||||
|
FileName = fileName;
|
||||||
|
Encoding = encoding;
|
||||||
|
using FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
|
||||||
|
ReadIniData(fs, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件名
|
||||||
|
/// </summary>
|
||||||
|
[Description("文件名")]
|
||||||
|
public string FileName { get; set; } //INI文件名
|
||||||
|
|
||||||
|
public Encoding Encoding { get; set; }
|
||||||
|
|
||||||
|
private void ReadIniData(Stream stream, Encoding encoding)
|
||||||
|
{
|
||||||
|
string lastSection = string.Empty;
|
||||||
|
data.Add(lastSection, new NameValueCollection());
|
||||||
|
if (stream != null && encoding != null)
|
||||||
|
{
|
||||||
|
using StreamReader reader = new StreamReader(stream, encoding);
|
||||||
|
string iniData = reader.ReadToEnd();
|
||||||
|
|
||||||
|
iniData = regRemoveEmptyLines.Replace(iniData, "\n");
|
||||||
|
string[] lines = iniData.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
|
foreach (string s in lines)
|
||||||
|
{
|
||||||
|
Match m = regParseIniData.Match(s);
|
||||||
|
if (m.Success)
|
||||||
|
{
|
||||||
|
if (m.Groups["IsSection"].Length > 0)
|
||||||
|
{
|
||||||
|
string sName = m.Groups["SectionName"].Value.ToLowerInvariant();
|
||||||
|
if (lastSection != sName)
|
||||||
|
{
|
||||||
|
lastSection = sName;
|
||||||
|
if (!data.ContainsKey(sName))
|
||||||
|
{
|
||||||
|
data.Add(sName, new NameValueCollection());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m.Groups["IsKeyValue"].Length > 0)
|
||||||
|
{
|
||||||
|
data[lastSection].Add(m.Groups["Key"].Value, m.Groups["Value"].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public NameValueCollection this[string section]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
section = section.ToLowerInvariant();
|
||||||
|
if (!data.ContainsKey(section))
|
||||||
|
data.Add(section, new NameValueCollection());
|
||||||
|
return data[section];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string this[string section, string key]
|
||||||
|
{
|
||||||
|
get => this[section][key];
|
||||||
|
set => this[section][key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object this[string section, string key, Type t]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (t == null || t == (Type)Type.Missing)
|
||||||
|
return this[section][key];
|
||||||
|
return GetValue(section, key, null, t);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (t == null || t == (Type)Type.Missing)
|
||||||
|
this[section][key] = string.Empty;
|
||||||
|
else
|
||||||
|
SetValue(section, key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] KeyNames(string section)
|
||||||
|
{
|
||||||
|
return this[section].AllKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string[] SectionValues(string section)
|
||||||
|
{
|
||||||
|
return this[section].GetValues(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private object GetValue(string section, string key, object defaultValue, Type t)
|
||||||
|
{
|
||||||
|
section = section.ToLowerInvariant();
|
||||||
|
key = key.ToLowerInvariant();
|
||||||
|
if (!data.ContainsKey(section)) return defaultValue;
|
||||||
|
string v = data[section][key];
|
||||||
|
if (string.IsNullOrEmpty(v)) return defaultValue;
|
||||||
|
TypeConverter conv = TypeDescriptor.GetConverter(t);
|
||||||
|
if (!conv.CanConvertFrom(typeof(string))) return defaultValue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return conv.ConvertFrom(v);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private T GetValue<T>(string section, string key, T defaultValue)
|
||||||
|
{
|
||||||
|
return (T)GetValue(section, key, defaultValue, typeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetValue(string section, string key, object value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
this[section][key] = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TypeConverter conv = TypeDescriptor.GetConverter(value);
|
||||||
|
if (!conv.CanConvertTo(typeof(string)))
|
||||||
|
{
|
||||||
|
this[section][key] = value.ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this[section][key] = (string)conv.ConvertTo(value, typeof(string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Write(string section, string key, string value)
|
||||||
|
{
|
||||||
|
SetValue(section, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Read(string section, string key, string Default)
|
||||||
|
{
|
||||||
|
return GetValue(section, key, Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取指定的Section的所有Value到列表中
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
public NameValueCollection GetSectionValues(string section)
|
||||||
|
{
|
||||||
|
return this[section];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateFile()
|
||||||
|
{
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
Save(FileName, Encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save(string fileName, Encoding encoding)
|
||||||
|
{
|
||||||
|
using FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
|
||||||
|
Save(fs, encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Save(Stream stream, Encoding encoding)
|
||||||
|
{
|
||||||
|
using StreamWriter sw = new StreamWriter(stream, encoding);
|
||||||
|
foreach (var cur in data)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(cur.Key))
|
||||||
|
{
|
||||||
|
sw.WriteLine("[{0}]", cur.Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
NameValueCollection col = cur.Value;
|
||||||
|
foreach (string key in col.Keys)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(key))
|
||||||
|
{
|
||||||
|
string value = col[key];
|
||||||
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
sw.WriteLine("{0}={1}", key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasSection(string section)
|
||||||
|
{
|
||||||
|
return data.ContainsKey(section.ToLowerInvariant());
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasKey(string section, string key)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
data.ContainsKey(section) &&
|
||||||
|
!string.IsNullOrEmpty(data[section][key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写结构
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
/// <typeparam name="T">T</typeparam>
|
||||||
|
public void WriteStruct<T>(string section, string key, T value) where T : struct
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读结构
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">T</typeparam>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public T ReadStruct<T>(string section, string key, T Default) where T : struct
|
||||||
|
{
|
||||||
|
//得到结构体的大小
|
||||||
|
int size = StructEx.Size(Default);
|
||||||
|
byte[] bytes = Read(section, key, "").ToHexBytes();
|
||||||
|
return size > bytes.Length ? Default : bytes.ToStruct<T>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Byte数组
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, byte[] value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToHexString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Byte数组
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public byte[] ReadBytes(string section, string key, byte[] Default)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToHexString()).ToHexBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Char
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, char value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Char
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public char ReadChar(string section, string key, char Default = ' ')
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToChar(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Decimal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, decimal value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Decimal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public decimal ReadDecimal(string section, string key, decimal Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString(CultureInfo.InvariantCulture)).ToDecimal(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, short value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public short ReadShort(string section, string key, short Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToShort(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, ushort value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public ushort ReadUShort(string section, string key, ushort Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToUShort(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, int value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public int ReadInt(string section, string key, int Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToInt(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, uint value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public uint ReadUInt(string section, string key, uint Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToUInt(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, ulong value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public ulong ReadULong(string section, string key, ulong Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToULong(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, long value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读整数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public long ReadLong(string section, string key, long Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToLong(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写布尔
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, bool value)
|
||||||
|
{
|
||||||
|
Write(section, key, value ? bool.TrueString : bool.FalseString);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读布尔
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public bool ReadBool(string section, string key, bool Default = false)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, Default.ToString());
|
||||||
|
if (string.Equals(str, bool.TrueString, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(str, bool.FalseString, StringComparison.CurrentCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Double
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, double value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Double
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public double ReadDouble(string section, string key, double Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString(CultureInfo.InvariantCulture)).ToDouble(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Float
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, float value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString(CultureInfo.InvariantCulture));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Float
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public float ReadFloat(string section, string key, float Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString(CultureInfo.InvariantCulture)).ToFloat(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Byte
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, byte value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Byte
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public byte ReadByte(string section, string key, byte Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToByte(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写SByte
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, sbyte value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Byte
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public sbyte ReadSByte(string section, string key, sbyte Default = 0)
|
||||||
|
{
|
||||||
|
return Read(section, key, Default.ToString()).ToSByte(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写DateTime
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, DateTime value)
|
||||||
|
{
|
||||||
|
Write(section, key, value.ToString(DateTimeEx.DateTimeFormat));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读DateTime
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public DateTime ReadDateTime(string section, string key, DateTime Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, Default.ToString(CultureInfo.InvariantCulture));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return str.ToDateTime(DateTimeEx.DateTimeFormat);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Point
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, Point value)
|
||||||
|
{
|
||||||
|
Write(section, key, ConvertEx.ObjectToString(value, typeof(Point)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Point
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public Point ReadPoint(string section, string key, Point Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, "");
|
||||||
|
return (Point)ConvertEx.StringToObject(str, typeof(Point), Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写PointF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, PointF value)
|
||||||
|
{
|
||||||
|
Write(section, key, ConvertEx.ObjectToString(value, typeof(PointF)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读PointF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public PointF ReadPointF(string section, string key, PointF Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, "");
|
||||||
|
return (PointF)ConvertEx.StringToObject(str, typeof(PointF), Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Size
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, Size value)
|
||||||
|
{
|
||||||
|
Write(section, key, ConvertEx.ObjectToString(value, typeof(Size)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Size
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public Size ReadSize(string section, string key, Size Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, "");
|
||||||
|
return (Size)ConvertEx.StringToObject(str, typeof(Size), Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写SizeF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, SizeF value)
|
||||||
|
{
|
||||||
|
Write(section, key, ConvertEx.ObjectToString(value, typeof(SizeF)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读SizeF
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public SizeF ReadSizeF(string section, string key, SizeF Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, "");
|
||||||
|
return (SizeF)ConvertEx.StringToObject(str, typeof(SizeF), Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写Color
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="value">value</param>
|
||||||
|
public void Write(string section, string key, Color value)
|
||||||
|
{
|
||||||
|
Write(section, key, ConvertEx.ObjectToString(value, typeof(Color)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读Color
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="section">section</param>
|
||||||
|
/// <param name="key">key</param>
|
||||||
|
/// <param name="Default">Normal</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public Color ReadColor(string section, string key, Color Default)
|
||||||
|
{
|
||||||
|
string str = Read(section, key, "");
|
||||||
|
return (Color)ConvertEx.StringToObject(str, typeof(Color), Default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
203
SunnyUI/Common/UMapper.cs
Normal file
203
SunnyUI/Common/UMapper.cs
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.dll can be used for free under the GPL-3.0 license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UMapper.cs
|
||||||
|
* 文件说明: 轻量级的对象映射框架,可以映射值类型(包括Struct),和以值类型构成的List和数组。
|
||||||
|
* 当前版本: V3.1
|
||||||
|
* 创建日期: 2021-09-30
|
||||||
|
*
|
||||||
|
* 2021-09-30: V3.0.7 增加文件说明
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 轻量级的对象映射框架
|
||||||
|
/// </summary>
|
||||||
|
public static class Mapper
|
||||||
|
{
|
||||||
|
private static void Execute<T1, T2>(T1 source, T2 dest)
|
||||||
|
where T1 : class, new()
|
||||||
|
where T2 : class, new()
|
||||||
|
{
|
||||||
|
if (source == null || dest == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var listSource = source.GetType().GetNeedProperties().ToDictionary(prop => prop.Name);
|
||||||
|
var listDest = dest.GetType().GetNeedProperties().ToDictionary(prop => prop.Name);
|
||||||
|
|
||||||
|
foreach (var item in listDest)
|
||||||
|
{
|
||||||
|
if (listSource.NotContainsKey(item.Key)) continue;
|
||||||
|
|
||||||
|
var sourceInfo = listSource[item.Key];
|
||||||
|
Type sourceType = sourceInfo.PropertyType;
|
||||||
|
object sourceValue = sourceInfo.GetValue(source, null);
|
||||||
|
|
||||||
|
var destInfo = item.Value;
|
||||||
|
Type destType = item.Value.PropertyType;
|
||||||
|
|
||||||
|
if (!sourceType.Equals(destType)) continue;
|
||||||
|
if (sourceType.IsValueType)
|
||||||
|
{
|
||||||
|
//Console.WriteLine("ValueType: " + item.Key + ", " + sourceType.FullName);
|
||||||
|
destInfo.SetValue(dest, sourceValue, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sourceType == typeof(string))
|
||||||
|
{
|
||||||
|
//Console.WriteLine("String: " + item.Key + ", " + sourceType.FullName);
|
||||||
|
destInfo.SetValue(dest, sourceValue, null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceType.IsList())
|
||||||
|
{
|
||||||
|
//Console.WriteLine("List: " + item.Key + ", " + sourceType.FullName);
|
||||||
|
Type[] sourceTypes = sourceType.GetGenericArguments();
|
||||||
|
Type[] destTypes = destType.GetGenericArguments();
|
||||||
|
if (sourceTypes.Length != 1) continue;
|
||||||
|
if (destTypes.Length != 1) continue;
|
||||||
|
if (!sourceTypes[0].Equals(destTypes[0])) continue;
|
||||||
|
|
||||||
|
if (sourceValue == null)
|
||||||
|
{
|
||||||
|
destInfo.SetValue(dest, null, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Type typeDataList = typeof(List<>).MakeGenericType(destTypes[0]);
|
||||||
|
MethodInfo AddInfo = typeDataList.GetMethod("Add", BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
if (AddInfo == null) continue;
|
||||||
|
|
||||||
|
if (sourceTypes[0].IsValueType || sourceTypes[0] == typeof(string))
|
||||||
|
{
|
||||||
|
object listvalue = typeDataList.InvokeMember(null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, new object[] { });
|
||||||
|
IEnumerable sourceList = sourceValue as IEnumerable;
|
||||||
|
foreach (var listItem in sourceList)
|
||||||
|
{
|
||||||
|
AddInfo.Invoke(listvalue, new[] { listItem });
|
||||||
|
}
|
||||||
|
|
||||||
|
destInfo.SetValue(dest, listvalue, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//暂时不考虑
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceType.IsArray)
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Array: " + item.Key + ", " + sourceType.FullName);
|
||||||
|
if (sourceValue == null)
|
||||||
|
{
|
||||||
|
destInfo.SetValue(dest, null, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ICollection sourceList = sourceValue as ICollection;
|
||||||
|
Type type = sourceType.GetElementType();
|
||||||
|
var array = Array.CreateInstance(type, sourceList.Count);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
foreach (var listItem in sourceList)
|
||||||
|
{
|
||||||
|
array.SetValue(listItem, index++);
|
||||||
|
}
|
||||||
|
|
||||||
|
destInfo.SetValue(dest, array, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceType.IsDictionary())
|
||||||
|
{
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//类没有无参构造函数的话,创建有问题
|
||||||
|
//if (sourceType.IsClass)
|
||||||
|
//{
|
||||||
|
// if (sourceValue == null)
|
||||||
|
// {
|
||||||
|
// destInfo.SetValue(dest, null, null);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// object obj = Activator.CreateInstance(sourceType, null);
|
||||||
|
// obj.MapperFrom(sourceValue);
|
||||||
|
// destInfo.SetValue(dest, obj, null);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// T1映射到T2
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T1">T1</typeparam>
|
||||||
|
/// <typeparam name="T2">T2</typeparam>
|
||||||
|
/// <param name="source">源</param>
|
||||||
|
/// <param name="dest">目标</param>
|
||||||
|
public static void MapperTo<T1, T2>(this T1 source, T2 dest)
|
||||||
|
where T1 : class, new()
|
||||||
|
where T2 : class, new()
|
||||||
|
{
|
||||||
|
Execute(source, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// T1从T2映射
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T1">T1</typeparam>
|
||||||
|
/// <typeparam name="T2">T2</typeparam>
|
||||||
|
/// <param name="source">源</param>
|
||||||
|
/// <param name="dest">目标</param>
|
||||||
|
public static void MapperFrom<T1, T2>(this T1 dest, T2 source)
|
||||||
|
where T1 : class, new()
|
||||||
|
where T2 : class, new()
|
||||||
|
{
|
||||||
|
Execute(source, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数组的类类型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="t">类型</param>
|
||||||
|
/// <returns>类类型</returns>
|
||||||
|
public static Type GetArrayElementType(this Type t)
|
||||||
|
{
|
||||||
|
if (!t.IsArray) return null;
|
||||||
|
string name = t.FullName.Replace("[]", string.Empty);
|
||||||
|
return t.Assembly.GetType(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -22,9 +22,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
public class Thunder : IDisposable
|
public class Thunder : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Timer timer;
|
private readonly System.Windows.Forms.Timer timer;
|
||||||
private bool Exit;
|
private bool Exit;
|
||||||
|
|
||||||
public delegate void OnTaskInfoChange(object sender, ThunderTask task);
|
public delegate void OnTaskInfoChange(object sender, ThunderTask task);
|
||||||
@ -52,7 +52,7 @@ namespace Sunny.UI
|
|||||||
public Thunder()
|
public Thunder()
|
||||||
{
|
{
|
||||||
InitSuccess = ThunderDll.Init();
|
InitSuccess = ThunderDll.Init();
|
||||||
timer = new Timer();
|
timer = new System.Windows.Forms.Timer();
|
||||||
timer.Interval = 1000;
|
timer.Interval = 1000;
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
@ -512,7 +512,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Status.DisplayText() + ",已完成:" + (Percent * 100.0f).ToString("F2") + "%,速度:" + Speed + "KB/s";
|
return Status.Description() + ",已完成:" + (Percent * 100.0f).ToString("F2") + "%,速度:" + Speed + "KB/s";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,43 +524,43 @@ namespace Sunny.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 无
|
/// 无
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("无")]
|
[Description("无")]
|
||||||
NOITEM = 0,
|
NOITEM = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 错误
|
/// 错误
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("错误")]
|
[Description("错误")]
|
||||||
TSC_ERROR,
|
TSC_ERROR,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 暂停
|
/// 暂停
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("暂停")]
|
[Description("暂停")]
|
||||||
TSC_PAUSE,
|
TSC_PAUSE,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下载
|
/// 下载
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("下载中")]
|
[Description("下载中")]
|
||||||
TSC_DOWNLOAD,
|
TSC_DOWNLOAD,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 完成
|
/// 完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("完成")]
|
[Description("完成")]
|
||||||
TSC_COMPLETE,
|
TSC_COMPLETE,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止开始
|
/// 停止开始
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("已开始")]
|
[Description("已开始")]
|
||||||
TSC_STARTENDING,
|
TSC_STARTENDING,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止完成
|
/// 停止完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DisplayText("已停止")]
|
[Description("已停止")]
|
||||||
TSC_STOPENDING
|
TSC_STOPENDING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
163
SunnyUI/Common/UXmlConfig.cs
Normal file
163
SunnyUI/Common/UXmlConfig.cs
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
|
* CopyRight (C) 2012-2023 ShenYongHua(沈永华).
|
||||||
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
|
*
|
||||||
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
|
* GitHub: https://github.com/yhuse/SunnyUI
|
||||||
|
*
|
||||||
|
* SunnyUI.Common.dll can be used for free under the MIT license.
|
||||||
|
* If you use this code, please keep this note.
|
||||||
|
* 如果您使用此代码,请保留此说明。
|
||||||
|
******************************************************************************
|
||||||
|
* 文件名称: UXmlConfig.cs
|
||||||
|
* 文件说明: XML 配置文件类
|
||||||
|
* 当前版本: V3.1
|
||||||
|
* 创建日期: 2020-01-01
|
||||||
|
*
|
||||||
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace Sunny.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// XML 配置文件类
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TConfig">类型</typeparam>
|
||||||
|
public class XmlConfig<TConfig> : BaseConfig<TConfig> where TConfig : XmlConfig<TConfig>, new()
|
||||||
|
{
|
||||||
|
#region 加载
|
||||||
|
/// <summary>
|
||||||
|
/// 当前可执行文件路径,末尾包括\
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
private static string CurrentDir()
|
||||||
|
{
|
||||||
|
return Environment.CurrentDirectory.DealPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>加载指定配置文件</summary>
|
||||||
|
/// <param name="filename">文件名</param>
|
||||||
|
/// <returns>结果</returns>
|
||||||
|
public override bool Load(string filename)
|
||||||
|
{
|
||||||
|
if (filename.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
filename = CurrentDir() + ConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filename.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
throw new ApplicationException($"未指定{typeof(TConfig).Name}的配置文件路径!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ConcurrentDictionary<string, Ident> idents = ConfigHelper.InitIdents(current);
|
||||||
|
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.Load(filename);
|
||||||
|
XmlElement root = doc.DocumentElement; //获取根节点
|
||||||
|
foreach (Ident ident in idents.Values)
|
||||||
|
{
|
||||||
|
if (root != null)
|
||||||
|
{
|
||||||
|
var elements = root.GetElementsByTagName(ident.Key);
|
||||||
|
if (elements.Count == 1)
|
||||||
|
{
|
||||||
|
if (ident.IsList)
|
||||||
|
{
|
||||||
|
ident.Values.Clear();
|
||||||
|
foreach (XmlNode node in elements[0].ChildNodes)
|
||||||
|
{
|
||||||
|
ident.Values.Add(node.InnerText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ident.Value = elements[0].InnerText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigHelper.LoadConfigValue(current, idents);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>保存到配置文件中去</summary>
|
||||||
|
/// <param name="filename">文件名</param>
|
||||||
|
public override void Save(string filename)
|
||||||
|
{
|
||||||
|
if (filename.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
filename = CurrentDir() + ConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filename.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
throw new ApplicationException($"未指定{typeof(TConfig).Name}的配置文件路径!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ConcurrentDictionary<string, Ident> idents = ConfigHelper.InitIdents(current);
|
||||||
|
ConfigHelper.SaveConfigValue(Current, idents);
|
||||||
|
|
||||||
|
List<string> strs = new List<string> { "<?xml version=" + "\"" + "1.0" + "\"" + " encoding=" + "\"" + "utf-8" + "\"" + "?> ", "<!--" + Description + "--> " };
|
||||||
|
|
||||||
|
strs.Add("<" + GetType().Name + ">");
|
||||||
|
|
||||||
|
SortedList<int, Ident> slist = new SortedList<int, Ident>();
|
||||||
|
foreach (var ident in idents.Values)
|
||||||
|
{
|
||||||
|
slist.Add(ident.Index, ident);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var ident in slist.Values)
|
||||||
|
{
|
||||||
|
if (!ident.Description.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
strs.Add(" <!--" + ident.Description + "-->");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ident.IsList)
|
||||||
|
{
|
||||||
|
strs.Add(" <" + ident.Key + ">" + ident.Value + "</" + ident.Key + ">");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strs.Add(" <" + ident.Key + ">");
|
||||||
|
foreach (string value in ident.Values)
|
||||||
|
{
|
||||||
|
strs.Add(" <Value>" + value + "</Value>");
|
||||||
|
}
|
||||||
|
|
||||||
|
strs.Add(" </" + ident.Key + ">");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
strs.Add("</" + GetType().Name + ">");
|
||||||
|
File.WriteAllLines(filename, strs.ToArray(), Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion 加载
|
||||||
|
}
|
||||||
|
}
|
@ -49,441 +49,459 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.m_colorTable = new Sunny.UI.UIColorTable();
|
m_colorTable = new UIColorTable();
|
||||||
this.m_colorSample = new Sunny.UI.LabelRotate();
|
m_colorSample = new LabelRotate();
|
||||||
this.edtA = new Sunny.UI.UITextBox();
|
edtA = new UITextBox();
|
||||||
this.edtR = new Sunny.UI.UITextBox();
|
edtR = new UITextBox();
|
||||||
this.edtG = new Sunny.UI.UITextBox();
|
edtG = new UITextBox();
|
||||||
this.edtB = new Sunny.UI.UITextBox();
|
edtB = new UITextBox();
|
||||||
this.lblA = new Sunny.UI.UILabel();
|
lblA = new UILabel();
|
||||||
this.lblR = new Sunny.UI.UILabel();
|
lblR = new UILabel();
|
||||||
this.lblG = new Sunny.UI.UILabel();
|
lblG = new UILabel();
|
||||||
this.lblB = new Sunny.UI.UILabel();
|
lblB = new UILabel();
|
||||||
this.m_colorWheel = new Sunny.UI.UIColorWheel();
|
m_colorWheel = new UIColorWheel();
|
||||||
this.m_colorBar = new Sunny.UI.HSLColorSlider();
|
m_colorBar = new HSLColorSlider();
|
||||||
this.m_opacitySlider = new Sunny.UI.ColorSlider();
|
m_opacitySlider = new ColorSlider();
|
||||||
this.btnOK = new Sunny.UI.UISymbolButton();
|
btnOK = new UISymbolButton();
|
||||||
this.btnCancel = new Sunny.UI.UISymbolButton();
|
btnCancel = new UISymbolButton();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// m_colorTable
|
// m_colorTable
|
||||||
//
|
//
|
||||||
this.m_colorTable.BackColor = System.Drawing.Color.Transparent;
|
m_colorTable.BackColor = Color.Transparent;
|
||||||
this.m_colorTable.Colors = new System.Drawing.Color[] {
|
m_colorTable.Colors = new Color[]
|
||||||
System.Drawing.Color.Black,
|
{
|
||||||
System.Drawing.Color.DarkGreen,
|
Color.Black,
|
||||||
System.Drawing.Color.DarkSlateGray,
|
Color.DarkGreen,
|
||||||
System.Drawing.Color.Purple,
|
Color.DarkSlateGray,
|
||||||
System.Drawing.Color.Maroon,
|
Color.Purple,
|
||||||
System.Drawing.Color.Teal,
|
Color.Maroon,
|
||||||
System.Drawing.Color.Green,
|
Color.Teal,
|
||||||
System.Drawing.Color.Olive,
|
Color.Green,
|
||||||
System.Drawing.Color.Navy,
|
Color.Olive,
|
||||||
System.Drawing.Color.Indigo,
|
Color.Navy,
|
||||||
System.Drawing.Color.MidnightBlue,
|
Color.Indigo,
|
||||||
System.Drawing.Color.DarkRed,
|
Color.MidnightBlue,
|
||||||
System.Drawing.Color.DarkMagenta,
|
Color.DarkRed,
|
||||||
System.Drawing.Color.DarkBlue,
|
Color.DarkMagenta,
|
||||||
System.Drawing.Color.DarkCyan,
|
Color.DarkBlue,
|
||||||
System.Drawing.Color.DarkOliveGreen,
|
Color.DarkCyan,
|
||||||
System.Drawing.Color.SaddleBrown,
|
Color.DarkOliveGreen,
|
||||||
System.Drawing.Color.ForestGreen,
|
Color.SaddleBrown,
|
||||||
System.Drawing.Color.OliveDrab,
|
Color.ForestGreen,
|
||||||
System.Drawing.Color.SeaGreen,
|
Color.OliveDrab,
|
||||||
System.Drawing.Color.DarkGoldenrod,
|
Color.SeaGreen,
|
||||||
System.Drawing.Color.DarkSlateBlue,
|
Color.DarkGoldenrod,
|
||||||
System.Drawing.Color.MediumBlue,
|
Color.DarkSlateBlue,
|
||||||
System.Drawing.Color.Sienna,
|
Color.MediumBlue,
|
||||||
System.Drawing.Color.Brown,
|
Color.Sienna,
|
||||||
System.Drawing.Color.DarkTurquoise,
|
Color.Brown,
|
||||||
System.Drawing.Color.DimGray,
|
Color.DarkTurquoise,
|
||||||
System.Drawing.Color.LightSeaGreen,
|
Color.DimGray,
|
||||||
System.Drawing.Color.DarkViolet,
|
Color.LightSeaGreen,
|
||||||
System.Drawing.Color.Firebrick,
|
Color.DarkViolet,
|
||||||
System.Drawing.Color.MediumVioletRed,
|
Color.Firebrick,
|
||||||
System.Drawing.Color.MediumSeaGreen,
|
Color.MediumVioletRed,
|
||||||
System.Drawing.Color.Crimson,
|
Color.MediumSeaGreen,
|
||||||
System.Drawing.Color.Chocolate,
|
Color.Crimson,
|
||||||
System.Drawing.Color.MediumSpringGreen,
|
Color.Chocolate,
|
||||||
System.Drawing.Color.Goldenrod,
|
Color.MediumSpringGreen,
|
||||||
System.Drawing.Color.SteelBlue,
|
Color.Goldenrod,
|
||||||
System.Drawing.Color.LawnGreen,
|
Color.SteelBlue,
|
||||||
System.Drawing.Color.DarkOrchid,
|
Color.LawnGreen,
|
||||||
System.Drawing.Color.Orange,
|
Color.DarkOrchid,
|
||||||
System.Drawing.Color.LimeGreen,
|
Color.Orange,
|
||||||
System.Drawing.Color.Yellow,
|
Color.LimeGreen,
|
||||||
System.Drawing.Color.Gold,
|
Color.Yellow,
|
||||||
System.Drawing.Color.Red,
|
Color.Gold,
|
||||||
System.Drawing.Color.Magenta,
|
Color.Red,
|
||||||
System.Drawing.Color.Lime,
|
Color.Magenta,
|
||||||
System.Drawing.Color.SpringGreen,
|
Color.Lime,
|
||||||
System.Drawing.Color.YellowGreen,
|
Color.SpringGreen,
|
||||||
System.Drawing.Color.Chartreuse,
|
Color.YellowGreen,
|
||||||
System.Drawing.Color.DeepSkyBlue,
|
Color.Chartreuse,
|
||||||
System.Drawing.Color.Aqua,
|
Color.DeepSkyBlue,
|
||||||
System.Drawing.Color.OrangeRed,
|
Color.Aqua,
|
||||||
System.Drawing.Color.Blue,
|
Color.OrangeRed,
|
||||||
System.Drawing.Color.DarkOrange,
|
Color.Blue,
|
||||||
System.Drawing.Color.CadetBlue,
|
Color.DarkOrange,
|
||||||
System.Drawing.Color.Cyan,
|
Color.CadetBlue,
|
||||||
System.Drawing.Color.Fuchsia,
|
Color.Cyan,
|
||||||
System.Drawing.Color.Gray,
|
Color.Fuchsia,
|
||||||
System.Drawing.Color.SlateGray,
|
Color.Gray,
|
||||||
System.Drawing.Color.Peru,
|
Color.SlateGray,
|
||||||
System.Drawing.Color.BlueViolet,
|
Color.Peru,
|
||||||
System.Drawing.Color.LightSlateGray,
|
Color.BlueViolet,
|
||||||
System.Drawing.Color.DeepPink,
|
Color.LightSlateGray,
|
||||||
System.Drawing.Color.MediumTurquoise,
|
Color.DeepPink,
|
||||||
System.Drawing.Color.DodgerBlue,
|
Color.MediumTurquoise,
|
||||||
System.Drawing.Color.Turquoise,
|
Color.DodgerBlue,
|
||||||
System.Drawing.Color.RoyalBlue,
|
Color.Turquoise,
|
||||||
System.Drawing.Color.SlateBlue,
|
Color.RoyalBlue,
|
||||||
System.Drawing.Color.MediumOrchid,
|
Color.SlateBlue,
|
||||||
System.Drawing.Color.DarkKhaki,
|
Color.MediumOrchid,
|
||||||
System.Drawing.Color.IndianRed,
|
Color.DarkKhaki,
|
||||||
System.Drawing.Color.GreenYellow,
|
Color.IndianRed,
|
||||||
System.Drawing.Color.MediumAquamarine,
|
Color.GreenYellow,
|
||||||
System.Drawing.Color.Tomato,
|
Color.MediumAquamarine,
|
||||||
System.Drawing.Color.DarkSeaGreen,
|
Color.Tomato,
|
||||||
System.Drawing.Color.Orchid,
|
Color.DarkSeaGreen,
|
||||||
System.Drawing.Color.RosyBrown,
|
Color.Orchid,
|
||||||
System.Drawing.Color.PaleVioletRed,
|
Color.RosyBrown,
|
||||||
System.Drawing.Color.MediumPurple,
|
Color.PaleVioletRed,
|
||||||
System.Drawing.Color.Coral,
|
Color.MediumPurple,
|
||||||
System.Drawing.Color.CornflowerBlue,
|
Color.Coral,
|
||||||
System.Drawing.Color.DarkGray,
|
Color.CornflowerBlue,
|
||||||
System.Drawing.Color.SandyBrown,
|
Color.DarkGray,
|
||||||
System.Drawing.Color.MediumSlateBlue,
|
Color.SandyBrown,
|
||||||
System.Drawing.Color.Tan,
|
Color.MediumSlateBlue,
|
||||||
System.Drawing.Color.DarkSalmon,
|
Color.Tan,
|
||||||
System.Drawing.Color.BurlyWood,
|
Color.DarkSalmon,
|
||||||
System.Drawing.Color.HotPink,
|
Color.BurlyWood,
|
||||||
System.Drawing.Color.Salmon,
|
Color.HotPink,
|
||||||
System.Drawing.Color.Violet,
|
Color.Salmon,
|
||||||
System.Drawing.Color.LightCoral,
|
Color.Violet,
|
||||||
System.Drawing.Color.SkyBlue,
|
Color.LightCoral,
|
||||||
System.Drawing.Color.LightSalmon,
|
Color.SkyBlue,
|
||||||
System.Drawing.Color.Khaki,
|
Color.LightSalmon,
|
||||||
System.Drawing.Color.Plum,
|
Color.Khaki,
|
||||||
System.Drawing.Color.LightGreen,
|
Color.Plum,
|
||||||
System.Drawing.Color.Aquamarine,
|
Color.LightGreen,
|
||||||
System.Drawing.Color.Silver,
|
Color.Aquamarine,
|
||||||
System.Drawing.Color.LightSkyBlue,
|
Color.Silver,
|
||||||
System.Drawing.Color.LightSteelBlue,
|
Color.LightSkyBlue,
|
||||||
System.Drawing.Color.LightBlue,
|
Color.LightSteelBlue,
|
||||||
System.Drawing.Color.PaleGreen,
|
Color.LightBlue,
|
||||||
System.Drawing.Color.PowderBlue,
|
Color.PaleGreen,
|
||||||
System.Drawing.Color.Thistle,
|
Color.PowderBlue,
|
||||||
System.Drawing.Color.PaleGoldenrod,
|
Color.Thistle,
|
||||||
System.Drawing.Color.PaleTurquoise,
|
Color.PaleGoldenrod,
|
||||||
System.Drawing.Color.LightGray,
|
Color.PaleTurquoise,
|
||||||
System.Drawing.Color.Wheat,
|
Color.LightGray,
|
||||||
System.Drawing.Color.NavajoWhite,
|
Color.Wheat,
|
||||||
System.Drawing.Color.Moccasin,
|
Color.NavajoWhite,
|
||||||
System.Drawing.Color.LightPink,
|
Color.Moccasin,
|
||||||
System.Drawing.Color.PeachPuff,
|
Color.LightPink,
|
||||||
System.Drawing.Color.Gainsboro,
|
Color.PeachPuff,
|
||||||
System.Drawing.Color.Pink,
|
Color.Gainsboro,
|
||||||
System.Drawing.Color.Bisque,
|
Color.Pink,
|
||||||
System.Drawing.Color.LightGoldenrodYellow,
|
Color.Bisque,
|
||||||
System.Drawing.Color.LemonChiffon,
|
Color.LightGoldenrodYellow,
|
||||||
System.Drawing.Color.BlanchedAlmond,
|
Color.LemonChiffon,
|
||||||
System.Drawing.Color.Beige,
|
Color.BlanchedAlmond,
|
||||||
System.Drawing.Color.AntiqueWhite,
|
Color.Beige,
|
||||||
System.Drawing.Color.PapayaWhip,
|
Color.AntiqueWhite,
|
||||||
System.Drawing.Color.Cornsilk,
|
Color.PapayaWhip,
|
||||||
System.Drawing.Color.LightYellow,
|
Color.Cornsilk,
|
||||||
System.Drawing.Color.LightCyan,
|
Color.LightYellow,
|
||||||
System.Drawing.Color.Lavender,
|
Color.LightCyan,
|
||||||
System.Drawing.Color.Linen,
|
Color.Lavender,
|
||||||
System.Drawing.Color.MistyRose,
|
Color.Linen,
|
||||||
System.Drawing.Color.OldLace,
|
Color.MistyRose,
|
||||||
System.Drawing.Color.WhiteSmoke,
|
Color.OldLace,
|
||||||
System.Drawing.Color.SeaShell,
|
Color.WhiteSmoke,
|
||||||
System.Drawing.Color.Azure,
|
Color.SeaShell,
|
||||||
System.Drawing.Color.Honeydew,
|
Color.Azure,
|
||||||
System.Drawing.Color.Ivory,
|
Color.Honeydew,
|
||||||
System.Drawing.Color.LavenderBlush,
|
Color.Ivory,
|
||||||
System.Drawing.Color.FloralWhite,
|
Color.LavenderBlush,
|
||||||
System.Drawing.Color.AliceBlue,
|
Color.FloralWhite,
|
||||||
System.Drawing.Color.MintCream,
|
Color.AliceBlue,
|
||||||
System.Drawing.Color.GhostWhite,
|
Color.MintCream,
|
||||||
System.Drawing.Color.Snow,
|
Color.GhostWhite,
|
||||||
System.Drawing.Color.White};
|
Color.Snow,
|
||||||
this.m_colorTable.Cols = 16;
|
Color.White
|
||||||
this.m_colorTable.FieldSize = new System.Drawing.Size(12, 12);
|
};
|
||||||
this.m_colorTable.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
m_colorTable.Cols = 16;
|
||||||
this.m_colorTable.Location = new System.Drawing.Point(10, 8);
|
m_colorTable.FieldSize = new Size(12, 12);
|
||||||
this.m_colorTable.Name = "m_colorTable";
|
m_colorTable.FrameColor = Color.FromArgb(80, 160, 255);
|
||||||
this.m_colorTable.Padding = new System.Windows.Forms.Padding(8);
|
m_colorTable.Location = new Point(10, 8);
|
||||||
this.m_colorTable.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
m_colorTable.Name = "m_colorTable";
|
||||||
this.m_colorTable.SelectedItem = System.Drawing.Color.Black;
|
m_colorTable.Padding = new System.Windows.Forms.Padding(8);
|
||||||
this.m_colorTable.Size = new System.Drawing.Size(253, 148);
|
m_colorTable.RotatePointAlignment = ContentAlignment.MiddleCenter;
|
||||||
this.m_colorTable.Style = Sunny.UI.UIStyle.Custom;
|
m_colorTable.SelectedItem = Color.Black;
|
||||||
this.m_colorTable.StyleCustomMode = false;
|
m_colorTable.Size = new Size(253, 148);
|
||||||
this.m_colorTable.TabIndex = 0;
|
m_colorTable.Style = UIStyle.Custom;
|
||||||
this.m_colorTable.TagString = null;
|
m_colorTable.TabIndex = 0;
|
||||||
this.m_colorTable.Text = "colorTable1";
|
m_colorTable.Text = "colorTable1";
|
||||||
this.m_colorTable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
m_colorTable.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
this.m_colorTable.TextAngle = 0F;
|
m_colorTable.TextAngle = 0F;
|
||||||
this.m_colorTable.SelectedIndexChanged += new System.EventHandler(this.m_colorTable_SelectedIndexChanged);
|
m_colorTable.SelectedIndexChanged += m_colorTable_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
// m_colorSample
|
// m_colorSample
|
||||||
//
|
//
|
||||||
this.m_colorSample.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
m_colorSample.FrameColor = Color.FromArgb(80, 160, 255);
|
||||||
this.m_colorSample.Location = new System.Drawing.Point(10, 163);
|
m_colorSample.Location = new Point(10, 163);
|
||||||
this.m_colorSample.Name = "m_colorSample";
|
m_colorSample.Name = "m_colorSample";
|
||||||
this.m_colorSample.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
m_colorSample.RotatePointAlignment = ContentAlignment.MiddleCenter;
|
||||||
this.m_colorSample.Size = new System.Drawing.Size(253, 26);
|
m_colorSample.Size = new Size(253, 26);
|
||||||
this.m_colorSample.Style = Sunny.UI.UIStyle.Custom;
|
m_colorSample.Style = UIStyle.Custom;
|
||||||
this.m_colorSample.StyleCustomMode = false;
|
m_colorSample.TabIndex = 1;
|
||||||
this.m_colorSample.TabIndex = 1;
|
m_colorSample.TabStop = false;
|
||||||
this.m_colorSample.TabStop = false;
|
m_colorSample.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
this.m_colorSample.TagString = null;
|
m_colorSample.TextAngle = 0F;
|
||||||
this.m_colorSample.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
m_colorSample.Paint += m_colorSample_Paint;
|
||||||
this.m_colorSample.TextAngle = 0F;
|
//
|
||||||
this.m_colorSample.Paint += new System.Windows.Forms.PaintEventHandler(this.m_colorSample_Paint);
|
|
||||||
//
|
|
||||||
// edtA
|
// edtA
|
||||||
//
|
//
|
||||||
this.edtA.Cursor = System.Windows.Forms.Cursors.IBeam;
|
edtA.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.edtA.FillColor = System.Drawing.Color.White;
|
edtA.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.edtA.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
edtA.Location = new Point(29, 197);
|
||||||
this.edtA.Location = new System.Drawing.Point(29, 197);
|
edtA.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.edtA.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
edtA.Maximum = 255D;
|
||||||
this.edtA.Maximum = 255D;
|
edtA.Minimum = 0D;
|
||||||
this.edtA.Minimum = 0D;
|
edtA.MinimumSize = new Size(1, 16);
|
||||||
this.edtA.Name = "edtA";
|
edtA.Name = "edtA";
|
||||||
this.edtA.Padding = new System.Windows.Forms.Padding(5);
|
edtA.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.edtA.Size = new System.Drawing.Size(41, 26);
|
edtA.ShowText = false;
|
||||||
this.edtA.Style = Sunny.UI.UIStyle.Custom;
|
edtA.Size = new Size(41, 26);
|
||||||
this.edtA.TabIndex = 2;
|
edtA.Style = UIStyle.Custom;
|
||||||
this.edtA.Text = "0";
|
edtA.TabIndex = 2;
|
||||||
this.edtA.Type = Sunny.UI.UITextBox.UIEditType.Integer;
|
edtA.Text = "0";
|
||||||
//
|
edtA.TextAlignment = ContentAlignment.MiddleLeft;
|
||||||
|
edtA.Type = UITextBox.UIEditType.Integer;
|
||||||
|
edtA.Watermark = "";
|
||||||
|
edtA.LostFocus += edtA_TextChanged;
|
||||||
|
//
|
||||||
// edtR
|
// edtR
|
||||||
//
|
//
|
||||||
this.edtR.Cursor = System.Windows.Forms.Cursors.IBeam;
|
edtR.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.edtR.FillColor = System.Drawing.Color.White;
|
edtR.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.edtR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
edtR.Location = new Point(93, 197);
|
||||||
this.edtR.Location = new System.Drawing.Point(93, 197);
|
edtR.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.edtR.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
edtR.Maximum = 255D;
|
||||||
this.edtR.Maximum = 255D;
|
edtR.Minimum = 0D;
|
||||||
this.edtR.Minimum = 0D;
|
edtR.MinimumSize = new Size(1, 16);
|
||||||
this.edtR.Name = "edtR";
|
edtR.Name = "edtR";
|
||||||
this.edtR.Padding = new System.Windows.Forms.Padding(5);
|
edtR.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.edtR.Size = new System.Drawing.Size(41, 26);
|
edtR.ShowText = false;
|
||||||
this.edtR.Style = Sunny.UI.UIStyle.Custom;
|
edtR.Size = new Size(41, 26);
|
||||||
this.edtR.TabIndex = 3;
|
edtR.Style = UIStyle.Custom;
|
||||||
this.edtR.Text = "0";
|
edtR.TabIndex = 3;
|
||||||
this.edtR.Type = Sunny.UI.UITextBox.UIEditType.Integer;
|
edtR.Text = "0";
|
||||||
//
|
edtR.TextAlignment = ContentAlignment.MiddleLeft;
|
||||||
|
edtR.Type = UITextBox.UIEditType.Integer;
|
||||||
|
edtR.Watermark = "";
|
||||||
|
edtR.LostFocus += edtR_TextChanged;
|
||||||
|
//
|
||||||
// edtG
|
// edtG
|
||||||
//
|
//
|
||||||
this.edtG.Cursor = System.Windows.Forms.Cursors.IBeam;
|
edtG.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.edtG.FillColor = System.Drawing.Color.White;
|
edtG.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.edtG.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
edtG.Location = new Point(158, 197);
|
||||||
this.edtG.Location = new System.Drawing.Point(158, 197);
|
edtG.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.edtG.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
edtG.Maximum = 255D;
|
||||||
this.edtG.Maximum = 255D;
|
edtG.Minimum = 0D;
|
||||||
this.edtG.Minimum = 0D;
|
edtG.MinimumSize = new Size(1, 16);
|
||||||
this.edtG.Name = "edtG";
|
edtG.Name = "edtG";
|
||||||
this.edtG.Padding = new System.Windows.Forms.Padding(5);
|
edtG.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.edtG.Size = new System.Drawing.Size(41, 26);
|
edtG.ShowText = false;
|
||||||
this.edtG.Style = Sunny.UI.UIStyle.Custom;
|
edtG.Size = new Size(41, 26);
|
||||||
this.edtG.TabIndex = 4;
|
edtG.Style = UIStyle.Custom;
|
||||||
this.edtG.Text = "0";
|
edtG.TabIndex = 4;
|
||||||
this.edtG.Type = Sunny.UI.UITextBox.UIEditType.Integer;
|
edtG.Text = "0";
|
||||||
//
|
edtG.TextAlignment = ContentAlignment.MiddleLeft;
|
||||||
|
edtG.Type = UITextBox.UIEditType.Integer;
|
||||||
|
edtG.Watermark = "";
|
||||||
|
edtG.LostFocus += edtG_TextChanged;
|
||||||
|
//
|
||||||
// edtB
|
// edtB
|
||||||
//
|
//
|
||||||
this.edtB.Cursor = System.Windows.Forms.Cursors.IBeam;
|
edtB.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.edtB.FillColor = System.Drawing.Color.White;
|
edtB.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.edtB.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
edtB.Location = new Point(222, 197);
|
||||||
this.edtB.Location = new System.Drawing.Point(222, 197);
|
edtB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.edtB.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
edtB.Maximum = 255D;
|
||||||
this.edtB.Maximum = 255D;
|
edtB.Minimum = 0D;
|
||||||
this.edtB.Minimum = 0D;
|
edtB.MinimumSize = new Size(1, 16);
|
||||||
this.edtB.Name = "edtB";
|
edtB.Name = "edtB";
|
||||||
this.edtB.Padding = new System.Windows.Forms.Padding(5);
|
edtB.Padding = new System.Windows.Forms.Padding(5);
|
||||||
this.edtB.Size = new System.Drawing.Size(41, 26);
|
edtB.ShowText = false;
|
||||||
this.edtB.Style = Sunny.UI.UIStyle.Custom;
|
edtB.Size = new Size(41, 26);
|
||||||
this.edtB.TabIndex = 5;
|
edtB.Style = UIStyle.Custom;
|
||||||
this.edtB.Text = "0";
|
edtB.TabIndex = 5;
|
||||||
this.edtB.Type = Sunny.UI.UITextBox.UIEditType.Integer;
|
edtB.Text = "0";
|
||||||
//
|
edtB.TextAlignment = ContentAlignment.MiddleLeft;
|
||||||
|
edtB.Type = UITextBox.UIEditType.Integer;
|
||||||
|
edtB.Watermark = "";
|
||||||
|
edtB.LostFocus += edtB_TextChanged;
|
||||||
|
//
|
||||||
// lblA
|
// lblA
|
||||||
//
|
//
|
||||||
this.lblA.AutoSize = true;
|
lblA.AutoSize = true;
|
||||||
this.lblA.BackColor = System.Drawing.Color.Transparent;
|
lblA.BackColor = Color.Transparent;
|
||||||
this.lblA.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
lblA.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.lblA.Location = new System.Drawing.Point(9, 200);
|
lblA.ForeColor = Color.FromArgb(48, 48, 48);
|
||||||
this.lblA.Name = "lblA";
|
lblA.Location = new Point(9, 200);
|
||||||
this.lblA.Size = new System.Drawing.Size(19, 20);
|
lblA.Name = "lblA";
|
||||||
this.lblA.Style = Sunny.UI.UIStyle.Custom;
|
lblA.Size = new Size(14, 14);
|
||||||
this.lblA.TabIndex = 6;
|
lblA.Style = UIStyle.Custom;
|
||||||
this.lblA.Text = "A";
|
lblA.TabIndex = 6;
|
||||||
this.lblA.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
lblA.Text = "A";
|
||||||
//
|
lblA.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
// lblR
|
// lblR
|
||||||
//
|
//
|
||||||
this.lblR.AutoSize = true;
|
lblR.AutoSize = true;
|
||||||
this.lblR.BackColor = System.Drawing.Color.Transparent;
|
lblR.BackColor = Color.Transparent;
|
||||||
this.lblR.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
lblR.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.lblR.Location = new System.Drawing.Point(74, 200);
|
lblR.ForeColor = Color.FromArgb(48, 48, 48);
|
||||||
this.lblR.Name = "lblR";
|
lblR.Location = new Point(74, 200);
|
||||||
this.lblR.Size = new System.Drawing.Size(18, 20);
|
lblR.Name = "lblR";
|
||||||
this.lblR.Style = Sunny.UI.UIStyle.Custom;
|
lblR.Size = new Size(14, 14);
|
||||||
this.lblR.TabIndex = 7;
|
lblR.Style = UIStyle.Custom;
|
||||||
this.lblR.Text = "R";
|
lblR.TabIndex = 7;
|
||||||
this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
lblR.Text = "R";
|
||||||
//
|
lblR.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
// lblG
|
// lblG
|
||||||
//
|
//
|
||||||
this.lblG.AutoSize = true;
|
lblG.AutoSize = true;
|
||||||
this.lblG.BackColor = System.Drawing.Color.Transparent;
|
lblG.BackColor = Color.Transparent;
|
||||||
this.lblG.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
lblG.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.lblG.Location = new System.Drawing.Point(138, 200);
|
lblG.ForeColor = Color.FromArgb(48, 48, 48);
|
||||||
this.lblG.Name = "lblG";
|
lblG.Location = new Point(138, 200);
|
||||||
this.lblG.Size = new System.Drawing.Size(19, 20);
|
lblG.Name = "lblG";
|
||||||
this.lblG.Style = Sunny.UI.UIStyle.Custom;
|
lblG.Size = new Size(14, 14);
|
||||||
this.lblG.TabIndex = 8;
|
lblG.Style = UIStyle.Custom;
|
||||||
this.lblG.Text = "G";
|
lblG.TabIndex = 8;
|
||||||
this.lblG.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
lblG.Text = "G";
|
||||||
//
|
lblG.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
// lblB
|
// lblB
|
||||||
//
|
//
|
||||||
this.lblB.AutoSize = true;
|
lblB.AutoSize = true;
|
||||||
this.lblB.BackColor = System.Drawing.Color.Transparent;
|
lblB.BackColor = Color.Transparent;
|
||||||
this.lblB.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
lblB.Font = new Font("宋体", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.lblB.Location = new System.Drawing.Point(203, 200);
|
lblB.ForeColor = Color.FromArgb(48, 48, 48);
|
||||||
this.lblB.Name = "lblB";
|
lblB.Location = new Point(203, 200);
|
||||||
this.lblB.Size = new System.Drawing.Size(18, 20);
|
lblB.Name = "lblB";
|
||||||
this.lblB.Style = Sunny.UI.UIStyle.Custom;
|
lblB.Size = new Size(14, 14);
|
||||||
this.lblB.TabIndex = 9;
|
lblB.Style = UIStyle.Custom;
|
||||||
this.lblB.Text = "B";
|
lblB.TabIndex = 9;
|
||||||
this.lblB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
lblB.Text = "B";
|
||||||
//
|
lblB.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
|
//
|
||||||
// m_colorWheel
|
// m_colorWheel
|
||||||
//
|
//
|
||||||
this.m_colorWheel.BackColor = System.Drawing.Color.Transparent;
|
m_colorWheel.BackColor = Color.Transparent;
|
||||||
this.m_colorWheel.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
m_colorWheel.FrameColor = Color.FromArgb(80, 160, 255);
|
||||||
this.m_colorWheel.Location = new System.Drawing.Point(269, 8);
|
m_colorWheel.Location = new Point(269, 8);
|
||||||
this.m_colorWheel.Name = "m_colorWheel";
|
m_colorWheel.Name = "m_colorWheel";
|
||||||
this.m_colorWheel.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(235)))), ((int)(((byte)(205)))));
|
m_colorWheel.SelectedColor = Color.FromArgb(254, 235, 205);
|
||||||
this.m_colorWheel.Size = new System.Drawing.Size(148, 148);
|
m_colorWheel.Size = new Size(148, 148);
|
||||||
this.m_colorWheel.Style = Sunny.UI.UIStyle.Custom;
|
m_colorWheel.Style = UIStyle.Custom;
|
||||||
this.m_colorWheel.StyleCustomMode = false;
|
m_colorWheel.TabIndex = 10;
|
||||||
this.m_colorWheel.TabIndex = 10;
|
m_colorWheel.Text = "colorWheel1";
|
||||||
this.m_colorWheel.TagString = null;
|
m_colorWheel.SelectedColorChanged += m_colorWheel_SelectedColorChanged;
|
||||||
this.m_colorWheel.Text = "colorWheel1";
|
//
|
||||||
this.m_colorWheel.SelectedColorChanged += new System.EventHandler(this.m_colorWheel_SelectedColorChanged);
|
|
||||||
//
|
|
||||||
// m_colorBar
|
// m_colorBar
|
||||||
//
|
//
|
||||||
this.m_colorBar.BackColor = System.Drawing.Color.Transparent;
|
m_colorBar.BackColor = Color.Transparent;
|
||||||
this.m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10);
|
m_colorBar.BarPadding = new System.Windows.Forms.Padding(12, 5, 32, 10);
|
||||||
this.m_colorBar.Color1 = System.Drawing.Color.Black;
|
m_colorBar.Color1 = Color.Black;
|
||||||
this.m_colorBar.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(127)))), ((int)(((byte)(127)))));
|
m_colorBar.Color2 = Color.FromArgb(127, 127, 127);
|
||||||
this.m_colorBar.Color3 = System.Drawing.Color.White;
|
m_colorBar.Color3 = Color.White;
|
||||||
this.m_colorBar.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
m_colorBar.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
this.m_colorBar.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
m_colorBar.FrameColor = Color.FromArgb(80, 160, 255);
|
||||||
this.m_colorBar.Location = new System.Drawing.Point(422, 8);
|
m_colorBar.Location = new Point(422, 8);
|
||||||
this.m_colorBar.Name = "m_colorBar";
|
m_colorBar.Name = "m_colorBar";
|
||||||
this.m_colorBar.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use3Colors;
|
m_colorBar.NumberOfColors = ColorSlider.eNumberOfColors.Use3Colors;
|
||||||
this.m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical;
|
m_colorBar.Orientation = System.Windows.Forms.Orientation.Vertical;
|
||||||
this.m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
m_colorBar.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
|
||||||
this.m_colorBar.Percent = 0F;
|
m_colorBar.Percent = 0F;
|
||||||
this.m_colorBar.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleRight;
|
m_colorBar.RotatePointAlignment = ContentAlignment.MiddleRight;
|
||||||
this.m_colorBar.Size = new System.Drawing.Size(45, 148);
|
m_colorBar.Size = new Size(45, 148);
|
||||||
this.m_colorBar.Style = Sunny.UI.UIStyle.Custom;
|
m_colorBar.Style = UIStyle.Custom;
|
||||||
this.m_colorBar.StyleCustomMode = false;
|
m_colorBar.TabIndex = 11;
|
||||||
this.m_colorBar.TabIndex = 11;
|
m_colorBar.Text = "Lightness";
|
||||||
this.m_colorBar.TagString = null;
|
m_colorBar.TextAlign = ContentAlignment.BottomCenter;
|
||||||
this.m_colorBar.Text = "Lightness";
|
m_colorBar.TextAngle = 270F;
|
||||||
this.m_colorBar.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
m_colorBar.ValueOrientation = ColorSlider.eValueOrientation.MaxToMin;
|
||||||
this.m_colorBar.TextAngle = 270F;
|
m_colorBar.SelectedValueChanged += m_colorBar_SelectedValueChanged;
|
||||||
this.m_colorBar.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MaxToMin;
|
//
|
||||||
this.m_colorBar.SelectedValueChanged += new System.EventHandler(this.m_colorBar_SelectedValueChanged);
|
|
||||||
//
|
|
||||||
// m_opacitySlider
|
// m_opacitySlider
|
||||||
//
|
//
|
||||||
this.m_opacitySlider.BackColor = System.Drawing.Color.Transparent;
|
m_opacitySlider.BackColor = Color.Transparent;
|
||||||
this.m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25);
|
m_opacitySlider.BarPadding = new System.Windows.Forms.Padding(60, 12, 80, 25);
|
||||||
this.m_opacitySlider.Color1 = System.Drawing.Color.White;
|
m_opacitySlider.Color1 = Color.White;
|
||||||
this.m_opacitySlider.Color2 = System.Drawing.Color.Black;
|
m_opacitySlider.Color2 = Color.Black;
|
||||||
this.m_opacitySlider.Color3 = System.Drawing.Color.Black;
|
m_opacitySlider.Color3 = Color.Black;
|
||||||
this.m_opacitySlider.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
m_opacitySlider.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||||
this.m_opacitySlider.ForeColor = System.Drawing.Color.Black;
|
m_opacitySlider.ForeColor = Color.Black;
|
||||||
this.m_opacitySlider.FrameColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
|
m_opacitySlider.FrameColor = Color.FromArgb(80, 160, 255);
|
||||||
this.m_opacitySlider.Location = new System.Drawing.Point(269, 163);
|
m_opacitySlider.Location = new Point(269, 163);
|
||||||
this.m_opacitySlider.Name = "m_opacitySlider";
|
m_opacitySlider.Name = "m_opacitySlider";
|
||||||
this.m_opacitySlider.NumberOfColors = Sunny.UI.ColorSlider.eNumberOfColors.Use2Colors;
|
m_opacitySlider.NumberOfColors = ColorSlider.eNumberOfColors.Use2Colors;
|
||||||
this.m_opacitySlider.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
m_opacitySlider.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||||
this.m_opacitySlider.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
m_opacitySlider.Padding = new System.Windows.Forms.Padding(5, 0, 0, 0);
|
||||||
this.m_opacitySlider.Percent = 1F;
|
m_opacitySlider.Percent = 1F;
|
||||||
this.m_opacitySlider.RotatePointAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
m_opacitySlider.RotatePointAlignment = ContentAlignment.MiddleCenter;
|
||||||
this.m_opacitySlider.Size = new System.Drawing.Size(198, 26);
|
m_opacitySlider.Size = new Size(198, 26);
|
||||||
this.m_opacitySlider.Style = Sunny.UI.UIStyle.Custom;
|
m_opacitySlider.Style = UIStyle.Custom;
|
||||||
this.m_opacitySlider.StyleCustomMode = false;
|
m_opacitySlider.TabIndex = 1;
|
||||||
this.m_opacitySlider.TabIndex = 1;
|
m_opacitySlider.Text = "Opacity";
|
||||||
this.m_opacitySlider.TagString = null;
|
m_opacitySlider.TextAlign = ContentAlignment.MiddleLeft;
|
||||||
this.m_opacitySlider.Text = "Opacity";
|
m_opacitySlider.TextAngle = 0F;
|
||||||
this.m_opacitySlider.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
m_opacitySlider.ValueOrientation = ColorSlider.eValueOrientation.MinToMax;
|
||||||
this.m_opacitySlider.TextAngle = 0F;
|
m_opacitySlider.SelectedValueChanged += m_opacitySlider_SelectedValueChanged;
|
||||||
this.m_opacitySlider.ValueOrientation = Sunny.UI.ColorSlider.eValueOrientation.MinToMax;
|
//
|
||||||
this.m_opacitySlider.SelectedValueChanged += new System.EventHandler(this.m_opacitySlider_SelectedValueChanged);
|
|
||||||
//
|
|
||||||
// btnOK
|
// btnOK
|
||||||
//
|
//
|
||||||
this.btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
|
btnOK.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.btnOK.Font = new System.Drawing.Font("宋体", 12F);
|
btnOK.Font = new Font("宋体", 12F);
|
||||||
this.btnOK.Location = new System.Drawing.Point(269, 197);
|
btnOK.Location = new Point(269, 197);
|
||||||
this.btnOK.Name = "btnOK";
|
btnOK.MinimumSize = new Size(1, 1);
|
||||||
this.btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
btnOK.Name = "btnOK";
|
||||||
this.btnOK.Size = new System.Drawing.Size(95, 26);
|
btnOK.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||||
this.btnOK.Style = Sunny.UI.UIStyle.Custom;
|
btnOK.Size = new Size(95, 26);
|
||||||
this.btnOK.TabIndex = 12;
|
btnOK.Style = UIStyle.Custom;
|
||||||
this.btnOK.Text = "确定";
|
btnOK.SymbolOffset = new Point(0, 1);
|
||||||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
btnOK.TabIndex = 12;
|
||||||
//
|
btnOK.Text = "确定";
|
||||||
|
btnOK.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnOK.Click += btnOK_Click;
|
||||||
|
//
|
||||||
// btnCancel
|
// btnCancel
|
||||||
//
|
//
|
||||||
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.btnCancel.Font = new System.Drawing.Font("宋体", 12F);
|
btnCancel.Font = new Font("宋体", 12F);
|
||||||
this.btnCancel.Location = new System.Drawing.Point(372, 197);
|
btnCancel.Location = new Point(372, 197);
|
||||||
this.btnCancel.Name = "btnCancel";
|
btnCancel.MinimumSize = new Size(1, 1);
|
||||||
this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Size = new System.Drawing.Size(95, 26);
|
btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
|
||||||
this.btnCancel.Style = Sunny.UI.UIStyle.Custom;
|
btnCancel.Size = new Size(95, 26);
|
||||||
this.btnCancel.Symbol = 61453;
|
btnCancel.Style = UIStyle.Custom;
|
||||||
this.btnCancel.TabIndex = 13;
|
btnCancel.Symbol = 361453;
|
||||||
this.btnCancel.Text = "取消";
|
btnCancel.SymbolOffset = new Point(0, 1);
|
||||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
btnCancel.TabIndex = 13;
|
||||||
//
|
btnCancel.Text = "取消";
|
||||||
|
btnCancel.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnCancel.Click += btnCancel_Click;
|
||||||
|
//
|
||||||
// UIColorItem
|
// UIColorItem
|
||||||
//
|
//
|
||||||
this.Controls.Add(this.btnCancel);
|
Controls.Add(btnCancel);
|
||||||
this.Controls.Add(this.btnOK);
|
Controls.Add(btnOK);
|
||||||
this.Controls.Add(this.m_opacitySlider);
|
Controls.Add(m_opacitySlider);
|
||||||
this.Controls.Add(this.m_colorBar);
|
Controls.Add(m_colorBar);
|
||||||
this.Controls.Add(this.m_colorWheel);
|
Controls.Add(m_colorWheel);
|
||||||
this.Controls.Add(this.lblB);
|
Controls.Add(lblB);
|
||||||
this.Controls.Add(this.lblG);
|
Controls.Add(lblG);
|
||||||
this.Controls.Add(this.lblR);
|
Controls.Add(lblR);
|
||||||
this.Controls.Add(this.lblA);
|
Controls.Add(lblA);
|
||||||
this.Controls.Add(this.edtB);
|
Controls.Add(edtB);
|
||||||
this.Controls.Add(this.edtG);
|
Controls.Add(edtG);
|
||||||
this.Controls.Add(this.edtR);
|
Controls.Add(edtR);
|
||||||
this.Controls.Add(this.edtA);
|
Controls.Add(edtA);
|
||||||
this.Controls.Add(this.m_colorSample);
|
Controls.Add(m_colorSample);
|
||||||
this.Controls.Add(this.m_colorTable);
|
Controls.Add(m_colorTable);
|
||||||
this.FillColor = System.Drawing.Color.White;
|
FillColor = Color.White;
|
||||||
this.Name = "UIColorItem";
|
Name = "UIColorItem";
|
||||||
this.Size = new System.Drawing.Size(476, 233);
|
Size = new Size(476, 233);
|
||||||
this.Style = Sunny.UI.UIStyle.Custom;
|
Style = UIStyle.Custom;
|
||||||
this.ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
this.PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e)
|
private void m_colorTable_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
@ -524,6 +542,19 @@ namespace Sunny.UI
|
|||||||
m_colorWheel.SetLightness(m_colorBar.SelectedHSLColor.Lightness);
|
m_colorWheel.SetLightness(m_colorBar.SelectedHSLColor.Lightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateInfo()
|
||||||
|
{
|
||||||
|
Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor);
|
||||||
|
string info = string.Format("{0} aRGB({1}, {2}, {3}, {4})", m_colorWheel.SelectedHSLColor.ToString(), c.A, c.R, c.G, c.B);
|
||||||
|
updateBox = true;
|
||||||
|
edtA.IntValue = c.A;
|
||||||
|
edtR.IntValue = c.R;
|
||||||
|
edtG.IntValue = c.G;
|
||||||
|
edtB.IntValue = c.B;
|
||||||
|
//m_infoLabel.Text = info;
|
||||||
|
updateBox = false;
|
||||||
|
}
|
||||||
|
|
||||||
private void m_opacitySlider_SelectedValueChanged(object sender, EventArgs e)
|
private void m_opacitySlider_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
m_opacity = Math.Max(0, m_opacitySlider.Percent);
|
m_opacity = Math.Max(0, m_opacitySlider.Percent);
|
||||||
@ -532,17 +563,6 @@ namespace Sunny.UI
|
|||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateInfo()
|
|
||||||
{
|
|
||||||
Color c = Color.FromArgb((int)Math.Floor(255f * m_opacity), m_selectedColor);
|
|
||||||
string info = string.Format("{0} aRGB({1}, {2}, {3}, {4})", m_colorWheel.SelectedHSLColor.ToString(), c.A, c.R, c.G, c.B);
|
|
||||||
edtA.IntValue = c.A;
|
|
||||||
edtR.IntValue = c.R;
|
|
||||||
edtG.IntValue = c.G;
|
|
||||||
edtB.IntValue = c.B;
|
|
||||||
//m_infoLabel.Text = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void m_colorWheel_SelectedColorChanged(object sender, EventArgs e)
|
private void m_colorWheel_SelectedColorChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Color selcol = m_colorWheel.SelectedColor;
|
Color selcol = m_colorWheel.SelectedColor;
|
||||||
@ -558,6 +578,8 @@ namespace Sunny.UI
|
|||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool updateBox = false;
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
@ -609,5 +631,30 @@ namespace Sunny.UI
|
|||||||
edtB.SetStyleColor(uiColor);
|
edtB.SetStyleColor(uiColor);
|
||||||
lblA.ForeColor = lblR.ForeColor = lblG.ForeColor = lblB.ForeColor = uiColor.PanelForeColor;
|
lblA.ForeColor = lblR.ForeColor = lblG.ForeColor = lblB.ForeColor = uiColor.PanelForeColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void edtR_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (updateBox) return;
|
||||||
|
SelectedColor = Color.FromArgb(SelectedColor.A, edtR.IntValue, SelectedColor.G, SelectedColor.B);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void edtG_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (updateBox) return;
|
||||||
|
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, edtG.IntValue, SelectedColor.B);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void edtB_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (updateBox) return;
|
||||||
|
SelectedColor = Color.FromArgb(SelectedColor.A, SelectedColor.R, SelectedColor.G, edtB.IntValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void edtA_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (updateBox) return;
|
||||||
|
SelectedColor = Color.FromArgb(edtA.IntValue, SelectedColor);
|
||||||
|
UpdateInfo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
52
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
52
SunnyUI/Controls/DropItem/UIComboBoxItem.Designer.cs
generated
@ -28,38 +28,38 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.listBox = new Sunny.UI.UIListBox();
|
listBox = new UIListBox();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// listBox
|
// listBox
|
||||||
//
|
//
|
||||||
this.listBox.BackColor = System.Drawing.Color.Transparent;
|
listBox.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
listBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.listBox.FillColor = System.Drawing.Color.White;
|
listBox.FillColor = System.Drawing.Color.White;
|
||||||
this.listBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
listBox.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
this.listBox.FormatString = "";
|
listBox.HoverColor = System.Drawing.Color.FromArgb(155, 200, 255);
|
||||||
this.listBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
|
listBox.ItemSelectForeColor = System.Drawing.Color.FromArgb(235, 243, 255);
|
||||||
this.listBox.Location = new System.Drawing.Point(0, 0);
|
listBox.Location = new System.Drawing.Point(0, 0);
|
||||||
this.listBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
listBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.listBox.MinimumSize = new System.Drawing.Size(1, 1);
|
listBox.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.listBox.Name = "listBox";
|
listBox.Name = "listBox";
|
||||||
this.listBox.Padding = new System.Windows.Forms.Padding(2);
|
listBox.Padding = new System.Windows.Forms.Padding(2);
|
||||||
this.listBox.Radius = 0;
|
listBox.Radius = 0;
|
||||||
this.listBox.Size = new System.Drawing.Size(184, 210);
|
listBox.ShowText = false;
|
||||||
this.listBox.TabIndex = 3;
|
listBox.Size = new System.Drawing.Size(184, 210);
|
||||||
this.listBox.Text = null;
|
listBox.TabIndex = 3;
|
||||||
this.listBox.Click += new System.EventHandler(this.ListBox_Click);
|
listBox.Text = null;
|
||||||
this.listBox.SelectedIndexChanged += new System.EventHandler(this.listBox_SelectedIndexChanged);
|
listBox.KeyDown += listBox_KeyDown;
|
||||||
this.listBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listBox_KeyDown);
|
listBox.Click += ListBox_Click;
|
||||||
|
listBox.SelectedIndexChanged += listBox_SelectedIndexChanged;
|
||||||
//
|
//
|
||||||
// UIComboBoxItem
|
// UIComboBoxItem
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.Controls.Add(this.listBox);
|
Controls.Add(listBox);
|
||||||
this.Name = "UIComboBoxItem";
|
Name = "UIComboBoxItem";
|
||||||
this.Size = new System.Drawing.Size(184, 210);
|
Size = new System.Drawing.Size(184, 210);
|
||||||
this.ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -20,7 +20,6 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
@ -53,24 +52,6 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public event EventHandler BeforeListClick;
|
public event EventHandler BeforeListClick;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置边框颜色
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">颜色</param>
|
|
||||||
public override void SetRectColor(Color color)
|
|
||||||
{
|
|
||||||
//listBox.ItemSelectBackColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 设置填充颜色
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">颜色</param>
|
|
||||||
public override void SetFillColor(Color color)
|
|
||||||
{
|
|
||||||
//ListBox.ItemSelectForeColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
|
private void listBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DoValueChanged(this, ListBox.SelectedValue);
|
DoValueChanged(this, ListBox.SelectedValue);
|
||||||
@ -83,5 +64,11 @@ namespace Sunny.UI
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||||
|
{
|
||||||
|
base.SetStyleColor(uiColor);
|
||||||
|
listBox.SetStyleColor(uiColor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -30,7 +30,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public class UIComboDataGridViewItem : UIDropDownItem, ITranslate
|
internal class UIComboDataGridViewItem : UIDropDownItem, ITranslate
|
||||||
{
|
{
|
||||||
private UIPanel panel;
|
private UIPanel panel;
|
||||||
private UISymbolButton btnCancel;
|
private UISymbolButton btnCancel;
|
||||||
@ -102,11 +102,11 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle11 = new DataGridViewCellStyle();
|
||||||
DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle12 = new DataGridViewCellStyle();
|
||||||
DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle13 = new DataGridViewCellStyle();
|
||||||
DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle14 = new DataGridViewCellStyle();
|
||||||
DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle15 = new DataGridViewCellStyle();
|
||||||
panel = new UIPanel();
|
panel = new UIPanel();
|
||||||
btnCancel = new UISymbolButton();
|
btnCancel = new UISymbolButton();
|
||||||
btnOK = new UISymbolButton();
|
btnOK = new UISymbolButton();
|
||||||
@ -159,9 +159,11 @@ namespace Sunny.UI
|
|||||||
btnCancel.Size = new System.Drawing.Size(80, 29);
|
btnCancel.Size = new System.Drawing.Size(80, 29);
|
||||||
btnCancel.Style = UIStyle.Custom;
|
btnCancel.Style = UIStyle.Custom;
|
||||||
btnCancel.StyleCustomMode = true;
|
btnCancel.StyleCustomMode = true;
|
||||||
btnCancel.Symbol = 61453;
|
btnCancel.Symbol = 361453;
|
||||||
|
btnCancel.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnCancel.TabIndex = 1;
|
btnCancel.TabIndex = 1;
|
||||||
btnCancel.Text = "取消";
|
btnCancel.Text = "取消";
|
||||||
|
btnCancel.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||||
btnCancel.Click += btnCancel_Click;
|
btnCancel.Click += btnCancel_Click;
|
||||||
//
|
//
|
||||||
// btnOK
|
// btnOK
|
||||||
@ -173,33 +175,35 @@ namespace Sunny.UI
|
|||||||
btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
btnOK.Name = "btnOK";
|
btnOK.Name = "btnOK";
|
||||||
btnOK.Size = new System.Drawing.Size(80, 29);
|
btnOK.Size = new System.Drawing.Size(80, 29);
|
||||||
|
btnOK.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnOK.TabIndex = 0;
|
btnOK.TabIndex = 0;
|
||||||
btnOK.Text = "确定";
|
btnOK.Text = "确定";
|
||||||
|
btnOK.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||||
btnOK.Click += btnOK_Click;
|
btnOK.Click += btnOK_Click;
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
dataGridViewCellStyle11.BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
||||||
dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
|
||||||
dataGridView.BackgroundColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
dataGridView.BackgroundColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
||||||
dataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
dataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
||||||
dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
dataGridViewCellStyle12.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||||
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
dataGridViewCellStyle12.BackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
||||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
|
dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White;
|
dataGridViewCellStyle12.ForeColor = System.Drawing.Color.White;
|
||||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
||||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||||
dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True;
|
dataGridViewCellStyle12.WrapMode = DataGridViewTriState.True;
|
||||||
dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
dataGridViewCellStyle13.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
||||||
dataGridViewCellStyle3.BackColor = System.Drawing.Color.White;
|
dataGridViewCellStyle13.BackColor = System.Drawing.Color.White;
|
||||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F);
|
dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle13.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(220, 236, 255);
|
dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(220, 236, 255);
|
||||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle13.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridViewCellStyle3.WrapMode = DataGridViewTriState.False;
|
dataGridViewCellStyle13.WrapMode = DataGridViewTriState.False;
|
||||||
dataGridView.DefaultCellStyle = dataGridViewCellStyle3;
|
dataGridView.DefaultCellStyle = dataGridViewCellStyle13;
|
||||||
dataGridView.Dock = DockStyle.Fill;
|
dataGridView.Dock = DockStyle.Fill;
|
||||||
dataGridView.EnableHeadersVisualStyles = false;
|
dataGridView.EnableHeadersVisualStyles = false;
|
||||||
dataGridView.Font = new System.Drawing.Font("宋体", 12F);
|
dataGridView.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
@ -207,19 +211,19 @@ namespace Sunny.UI
|
|||||||
dataGridView.Location = new System.Drawing.Point(0, 44);
|
dataGridView.Location = new System.Drawing.Point(0, 44);
|
||||||
dataGridView.MultiSelect = false;
|
dataGridView.MultiSelect = false;
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
dataGridViewCellStyle14.Alignment = DataGridViewContentAlignment.MiddleLeft;
|
||||||
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
dataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(243, 249, 255);
|
||||||
dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F);
|
dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F);
|
||||||
dataGridViewCellStyle4.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle14.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
dataGridViewCellStyle14.SelectionBackColor = System.Drawing.Color.FromArgb(80, 160, 255);
|
||||||
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle14.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridViewCellStyle4.WrapMode = DataGridViewTriState.True;
|
dataGridViewCellStyle14.WrapMode = DataGridViewTriState.True;
|
||||||
dataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle4;
|
dataGridView.RowHeadersDefaultCellStyle = dataGridViewCellStyle14;
|
||||||
dataGridViewCellStyle5.BackColor = System.Drawing.Color.White;
|
dataGridViewCellStyle15.BackColor = System.Drawing.Color.White;
|
||||||
dataGridViewCellStyle5.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle15.ForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(220, 236, 255);
|
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(220, 236, 255);
|
||||||
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.FromArgb(48, 48, 48);
|
||||||
dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle5;
|
dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle15;
|
||||||
dataGridView.SelectedIndex = -1;
|
dataGridView.SelectedIndex = -1;
|
||||||
dataGridView.Size = new System.Drawing.Size(569, 245);
|
dataGridView.Size = new System.Drawing.Size(569, 245);
|
||||||
dataGridView.TabIndex = 3;
|
dataGridView.TabIndex = 3;
|
||||||
@ -252,10 +256,12 @@ namespace Sunny.UI
|
|||||||
btnClear.MinimumSize = new System.Drawing.Size(1, 1);
|
btnClear.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
btnClear.Name = "btnClear";
|
btnClear.Name = "btnClear";
|
||||||
btnClear.Size = new System.Drawing.Size(80, 29);
|
btnClear.Size = new System.Drawing.Size(80, 29);
|
||||||
btnClear.Symbol = 61666;
|
btnClear.Symbol = 361666;
|
||||||
|
btnClear.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnClear.SymbolSize = 22;
|
btnClear.SymbolSize = 22;
|
||||||
btnClear.TabIndex = 2;
|
btnClear.TabIndex = 2;
|
||||||
btnClear.Text = "清除";
|
btnClear.Text = "清除";
|
||||||
|
btnClear.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||||
btnClear.Click += btnClear_Click;
|
btnClear.Click += btnClear_Click;
|
||||||
//
|
//
|
||||||
// btnSearch
|
// btnSearch
|
||||||
@ -267,9 +273,11 @@ namespace Sunny.UI
|
|||||||
btnSearch.MinimumSize = new System.Drawing.Size(1, 1);
|
btnSearch.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
btnSearch.Name = "btnSearch";
|
btnSearch.Name = "btnSearch";
|
||||||
btnSearch.Size = new System.Drawing.Size(80, 29);
|
btnSearch.Size = new System.Drawing.Size(80, 29);
|
||||||
btnSearch.Symbol = 61442;
|
btnSearch.Symbol = 361442;
|
||||||
|
btnSearch.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnSearch.TabIndex = 1;
|
btnSearch.TabIndex = 1;
|
||||||
btnSearch.Text = "搜索";
|
btnSearch.Text = "搜索";
|
||||||
|
btnSearch.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
||||||
btnSearch.Click += btnSearch_Click;
|
btnSearch.Click += btnSearch_Click;
|
||||||
//
|
//
|
||||||
// edtFilter
|
// edtFilter
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public class UIComboTreeViewItem : UIDropDownItem, ITranslate
|
internal class UIComboTreeViewItem : UIDropDownItem, ITranslate
|
||||||
{
|
{
|
||||||
private UIPanel panel;
|
private UIPanel panel;
|
||||||
private UISymbolButton btnCancel;
|
private UISymbolButton btnCancel;
|
||||||
@ -78,6 +78,7 @@ namespace Sunny.UI
|
|||||||
treeView.MinimumSize = new System.Drawing.Size(1, 1);
|
treeView.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
treeView.Name = "treeView";
|
treeView.Name = "treeView";
|
||||||
treeView.RadiusSides = UICornerRadiusSides.None;
|
treeView.RadiusSides = UICornerRadiusSides.None;
|
||||||
|
treeView.ScrollBarStyleInherited = false;
|
||||||
treeView.ShowText = false;
|
treeView.ShowText = false;
|
||||||
treeView.Size = new System.Drawing.Size(250, 176);
|
treeView.Size = new System.Drawing.Size(250, 176);
|
||||||
treeView.TabIndex = 0;
|
treeView.TabIndex = 0;
|
||||||
@ -129,6 +130,7 @@ namespace Sunny.UI
|
|||||||
btnCancel.Size = new System.Drawing.Size(80, 29);
|
btnCancel.Size = new System.Drawing.Size(80, 29);
|
||||||
btnCancel.StyleCustomMode = true;
|
btnCancel.StyleCustomMode = true;
|
||||||
btnCancel.Symbol = 361453;
|
btnCancel.Symbol = 361453;
|
||||||
|
btnCancel.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnCancel.SymbolSize = 22;
|
btnCancel.SymbolSize = 22;
|
||||||
btnCancel.TabIndex = 1;
|
btnCancel.TabIndex = 1;
|
||||||
btnCancel.Text = "取消";
|
btnCancel.Text = "取消";
|
||||||
@ -144,6 +146,7 @@ namespace Sunny.UI
|
|||||||
btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
btnOK.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
btnOK.Name = "btnOK";
|
btnOK.Name = "btnOK";
|
||||||
btnOK.Size = new System.Drawing.Size(80, 29);
|
btnOK.Size = new System.Drawing.Size(80, 29);
|
||||||
|
btnOK.SymbolOffset = new System.Drawing.Point(0, 1);
|
||||||
btnOK.SymbolSize = 22;
|
btnOK.SymbolSize = 22;
|
||||||
btnOK.TabIndex = 0;
|
btnOK.TabIndex = 0;
|
||||||
btnOK.Text = "确定";
|
btnOK.Text = "确定";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -270,7 +270,7 @@ namespace Sunny.UI
|
|||||||
tabPage3.Controls.Add(p3);
|
tabPage3.Controls.Add(p3);
|
||||||
tabPage3.Location = new Point(0, 40);
|
tabPage3.Location = new Point(0, 40);
|
||||||
tabPage3.Name = "tabPage3";
|
tabPage3.Name = "tabPage3";
|
||||||
tabPage3.Size = new Size(461, 277);
|
tabPage3.Size = new Size(200, 60);
|
||||||
tabPage3.TabIndex = 2;
|
tabPage3.TabIndex = 2;
|
||||||
tabPage3.Text = "tabPage3";
|
tabPage3.Text = "tabPage3";
|
||||||
tabPage3.UseVisualStyleBackColor = true;
|
tabPage3.UseVisualStyleBackColor = true;
|
||||||
@ -285,7 +285,7 @@ namespace Sunny.UI
|
|||||||
p3.MinimumSize = new Size(1, 1);
|
p3.MinimumSize = new Size(1, 1);
|
||||||
p3.Name = "p3";
|
p3.Name = "p3";
|
||||||
p3.RadiusSides = UICornerRadiusSides.None;
|
p3.RadiusSides = UICornerRadiusSides.None;
|
||||||
p3.Size = new Size(461, 277);
|
p3.Size = new Size(200, 60);
|
||||||
p3.Style = UIStyle.Custom;
|
p3.Style = UIStyle.Custom;
|
||||||
p3.TabIndex = 2;
|
p3.TabIndex = 2;
|
||||||
p3.Text = null;
|
p3.Text = null;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -89,6 +89,12 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主题样式
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(UIStyle.Inherited), Description("下拉框主题样式"), Category("SunnyUI")]
|
||||||
|
public UIStyle StyleDropDown { get; set; } = UIStyle.Inherited;
|
||||||
|
|
||||||
public override void SetDPIScale()
|
public override void SetDPIScale()
|
||||||
{
|
{
|
||||||
base.SetDPIScale();
|
base.SetDPIScale();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -3,7 +3,7 @@ using System.Drawing;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public sealed class UINumPadItem : UIDropDownItem
|
internal sealed class UINumPadItem : UIDropDownItem
|
||||||
{
|
{
|
||||||
public UINumPadItem()
|
public UINumPadItem()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
* Gitee: https://gitee.com/yhuse/SunnyUI
|
* Gitee: https://gitee.com/yhuse/SunnyUI
|
||||||
@ -9,13 +9,13 @@
|
|||||||
*
|
*
|
||||||
* SunnyUI can be used for free under the GPL-3.0 license.
|
* SunnyUI can be used for free under the GPL-3.0 license.
|
||||||
* If you use this code, please keep this note.
|
* If you use this code, please keep this note.
|
||||||
* 如果您使用此代码,请保留此说明。
|
* 如果您使用此代码,请保留此说明。
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* 文件名称: UIAnalogMeter.cs
|
* 文件名称: UIAnalogMeter.cs
|
||||||
* 文件说明: 仪表
|
* 文件说明: 仪表
|
||||||
* 文件作者: Luca Bonotto
|
* 文件作者: Luca Bonotto
|
||||||
* 开源协议: CPOL
|
* 开源协议: CPOL
|
||||||
* 引用地址: https://www.codeproject.com/Articles/24945/Analog-Meter
|
* 引用地址: https://www.codeproject.com/Articles/24945/Analog-Meter
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -42,6 +42,7 @@ namespace Sunny.UI
|
|||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
[DefaultEvent("ValueChanged")]
|
[DefaultEvent("ValueChanged")]
|
||||||
[DefaultProperty("Value")]
|
[DefaultProperty("Value")]
|
||||||
|
[Description("仪表控件")]
|
||||||
public class UIAnalogMeter : UIControl
|
public class UIAnalogMeter : UIControl
|
||||||
{
|
{
|
||||||
#region Enumerator
|
#region Enumerator
|
||||||
@ -320,9 +321,9 @@ namespace Sunny.UI
|
|||||||
#region Events delegates
|
#region Events delegates
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重载控件尺寸变更
|
/// 重载控件尺寸变更
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">参数</param>
|
/// <param name="e">参数</param>
|
||||||
protected override void OnSizeChanged(EventArgs e)
|
protected override void OnSizeChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnSizeChanged(e);
|
base.OnSizeChanged(e);
|
||||||
@ -333,9 +334,9 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重载绘图
|
/// 重载绘图
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">绘图参数</param>
|
/// <param name="e">绘图参数</param>
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
if (Width <= 0 || Height <= 0) return;
|
if (Width <= 0 || Height <= 0) return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -37,6 +37,7 @@ namespace Sunny.UI
|
|||||||
[DefaultEvent("Click")]
|
[DefaultEvent("Click")]
|
||||||
[DefaultProperty("Symbol")]
|
[DefaultProperty("Symbol")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("头像控件")]
|
||||||
public sealed class UIAvatar : UIControl, ISymbol, IZoomScale
|
public sealed class UIAvatar : UIControl, ISymbol, IZoomScale
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -20,6 +20,7 @@
|
|||||||
* 2021-06-18: V3.0.4 修改可自定义背景色
|
* 2021-06-18: V3.0.4 修改可自定义背景色
|
||||||
* 2022-03-19: V3.1.1 重构主题配色
|
* 2022-03-19: V3.1.1 重构主题配色
|
||||||
* 2023-11-16: V3.5.2 重构主题
|
* 2023-11-16: V3.5.2 重构主题
|
||||||
|
* 2025-03-04: V3.8.1 增加图标旋转角度,增加图标偏移位置,调整图标最大值
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -34,6 +35,7 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultProperty("Power")]
|
[DefaultProperty("Power")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("电池电量控件")]
|
||||||
public sealed class UIBattery : UIControl
|
public sealed class UIBattery : UIControl
|
||||||
{
|
{
|
||||||
private Color colorDanger = UIColor.Orange;
|
private Color colorDanger = UIColor.Orange;
|
||||||
@ -85,7 +87,44 @@ namespace Sunny.UI
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
symbolSize = Math.Max(value, 16);
|
symbolSize = Math.Max(value, 16);
|
||||||
symbolSize = Math.Min(value, 128);
|
symbolSize = Math.Min(value, 256);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _symbolRotate = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字体图标旋转角度
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(0)]
|
||||||
|
[Description("字体图标旋转角度"), Category("SunnyUI")]
|
||||||
|
public int SymbolRotate
|
||||||
|
{
|
||||||
|
get => _symbolRotate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_symbolRotate != value)
|
||||||
|
{
|
||||||
|
_symbolRotate = value;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point symbolOffset = new Point(0, 0);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 字体图标的偏移位置
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(typeof(Point), "0, 0")]
|
||||||
|
[Description("字体图标的偏移位置"), Category("SunnyUI")]
|
||||||
|
public Point SymbolOffset
|
||||||
|
{
|
||||||
|
get => symbolOffset;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
symbolOffset = value;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -219,7 +258,7 @@ namespace Sunny.UI
|
|||||||
if (multiColor) color = ColorEmpty;
|
if (multiColor) color = ColorEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
g.DrawFontImage(ShowSymbol, SymbolSize, color, new Rectangle(0, 0, Width, Height));
|
g.DrawFontImage(ShowSymbol, SymbolSize, color, new Rectangle(0, 0, Width, Height), SymbolOffset.X, SymbolOffset.Y, SymbolRotate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -22,6 +22,7 @@
|
|||||||
* 2022-03-19: V3.1.1 重构主题配色
|
* 2022-03-19: V3.1.1 重构主题配色
|
||||||
* 2023-05-12: V3.3.6 重构DrawString函数
|
* 2023-05-12: V3.3.6 重构DrawString函数
|
||||||
* 2023-09-17: V3.4.2 增加Readonly,禁用鼠标点击,可通过代码设置ItemIndex
|
* 2023-09-17: V3.4.2 增加Readonly,禁用鼠标点击,可通过代码设置ItemIndex
|
||||||
|
* 2025-04-03: V3.8.2 增加SetItemColor,设置单个节点颜色,可以用RemoveItemColor移除
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -41,6 +42,7 @@ namespace Sunny.UI
|
|||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
[DefaultEvent("ItemIndexChanged")]
|
[DefaultEvent("ItemIndexChanged")]
|
||||||
[DefaultProperty("ItemIndex")]
|
[DefaultProperty("ItemIndex")]
|
||||||
|
[Description("面包屑导航条控件")]
|
||||||
public class UIBreadcrumb : UIControl
|
public class UIBreadcrumb : UIControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -111,6 +113,20 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private readonly ConcurrentDictionary<int, Point[]> ClickArea = new ConcurrentDictionary<int, Point[]>();
|
private readonly ConcurrentDictionary<int, Point[]> ClickArea = new ConcurrentDictionary<int, Point[]>();
|
||||||
|
|
||||||
|
private readonly ConcurrentDictionary<int, Color> ItemsColor = new();
|
||||||
|
|
||||||
|
public void SetItemColor(int index, Color color)
|
||||||
|
{
|
||||||
|
ItemsColor[index] = color;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveItemColor(int index)
|
||||||
|
{
|
||||||
|
ItemsColor.TryRemove(index, out _);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 步骤个数
|
/// 步骤个数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -230,7 +246,9 @@ namespace Sunny.UI
|
|||||||
ClickArea[index] = pts;
|
ClickArea[index] = pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
using Brush br = new SolidBrush(index <= ItemIndex ? SelectedColor : UnSelectedColor);
|
Color color = index <= ItemIndex ? SelectedColor : UnSelectedColor;
|
||||||
|
if (ItemsColor.TryGetValue(index, out var cc)) color = cc;
|
||||||
|
using Brush br = new SolidBrush(color);
|
||||||
g.FillPolygon(br, points.ToArray());
|
g.FillPolygon(br, points.ToArray());
|
||||||
|
|
||||||
g.DrawString(item.ToString(), Font, index <= ItemIndex ? ForeColor : UnSelectedForeColor,
|
g.DrawString(item.ToString(), Font, index <= ItemIndex ? ForeColor : UnSelectedForeColor,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -52,6 +52,7 @@ namespace Sunny.UI
|
|||||||
[DefaultEvent("Click")]
|
[DefaultEvent("Click")]
|
||||||
[DefaultProperty("Text")]
|
[DefaultProperty("Text")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("按钮控件")]
|
||||||
public class UIButton : UIControl, IButtonControl
|
public class UIButton : UIControl, IButtonControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -63,7 +64,7 @@ namespace Sunny.UI
|
|||||||
TabStop = true;
|
TabStop = true;
|
||||||
Width = 100;
|
Width = 100;
|
||||||
Height = 35;
|
Height = 35;
|
||||||
Cursor = Cursors.Hand;
|
base.Cursor = Cursors.Hand;
|
||||||
|
|
||||||
plainColor = UIStyles.Blue.PlainColor;
|
plainColor = UIStyles.Blue.PlainColor;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -19,6 +19,7 @@
|
|||||||
* 2022-06-28: V3.2.0 增加文件说明
|
* 2022-06-28: V3.2.0 增加文件说明
|
||||||
* 2023-05-13: V3.3.6 重构DrawString函数
|
* 2023-05-13: V3.3.6 重构DrawString函数
|
||||||
* 2023-11-13: V3.5.2 重构主题
|
* 2023-11-13: V3.5.2 重构主题
|
||||||
|
* 2024-12-02: V3.8.0 切换语言实时刷新
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -29,7 +30,8 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public class UICalendar : UIUserControl
|
[Description("日历控件")]
|
||||||
|
public class UICalendar : UIUserControl, ITranslate
|
||||||
{
|
{
|
||||||
public UICalendar()
|
public UICalendar()
|
||||||
{
|
{
|
||||||
@ -330,6 +332,10 @@ namespace Sunny.UI
|
|||||||
months.Add(UIStyles.CurrentResources.October);
|
months.Add(UIStyles.CurrentResources.October);
|
||||||
months.Add(UIStyles.CurrentResources.November);
|
months.Add(UIStyles.CurrentResources.November);
|
||||||
months.Add(UIStyles.CurrentResources.December);
|
months.Add(UIStyles.CurrentResources.December);
|
||||||
|
|
||||||
|
p1.Invalidate();
|
||||||
|
p2.Invalidate();
|
||||||
|
p3.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TopPanel_Click(object sender, EventArgs e)
|
private void TopPanel_Click(object sender, EventArgs e)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -42,6 +42,7 @@ namespace Sunny.UI
|
|||||||
[DefaultEvent("CheckedChanged")]
|
[DefaultEvent("CheckedChanged")]
|
||||||
[DefaultProperty("Checked")]
|
[DefaultProperty("Checked")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("复选框控件")]
|
||||||
public class UICheckBox : UIControl
|
public class UICheckBox : UIControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -27,6 +27,7 @@
|
|||||||
* 2023-11-07: V3.5.2 重写UICheckBoxGroup
|
* 2023-11-07: V3.5.2 重写UICheckBoxGroup
|
||||||
* 2023-12-04: V3.6.1 增加属性可修改图标大小
|
* 2023-12-04: V3.6.1 增加属性可修改图标大小
|
||||||
* 2024-09-09: V3.7.0 更改计算节点位置的方法,解决问题:#IAPY94
|
* 2024-09-09: V3.7.0 更改计算节点位置的方法,解决问题:#IAPY94
|
||||||
|
* 2024-11-29: V3.8.0 修复TitleTop为0时,条目显示错位的问题 #IB7STO
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -43,6 +44,7 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultProperty("Items")]
|
[DefaultProperty("Items")]
|
||||||
[DefaultEvent("ValueChanged")]
|
[DefaultEvent("ValueChanged")]
|
||||||
|
[Description("多选框组控件")]
|
||||||
public class UICheckBoxGroup : UIGroupBox
|
public class UICheckBoxGroup : UIGroupBox
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -206,11 +208,13 @@ namespace Sunny.UI
|
|||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnPaint(e);
|
base.OnPaint(e);
|
||||||
|
if (TitleTop == 0 && Text.IsValid()) Text = "";
|
||||||
if (Items.Count == 0) return;
|
if (Items.Count == 0) return;
|
||||||
|
InitRects();
|
||||||
|
|
||||||
if (activeIndex >= 0 && CheckBoxRects.ContainsKey(activeIndex))
|
if (activeIndex >= 0 && CheckBoxRects.TryGetValue(activeIndex, out Rectangle boxRect))
|
||||||
{
|
{
|
||||||
e.Graphics.FillRectangle(hoverColor, CheckBoxRects[activeIndex]);
|
e.Graphics.FillRectangle(hoverColor, boxRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
int startX = StartPos.X;
|
int startX = StartPos.X;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -20,6 +20,7 @@
|
|||||||
* 2021-03-13: V3.0.2 增加单击事件以选中颜色
|
* 2021-03-13: V3.0.2 增加单击事件以选中颜色
|
||||||
* 2022-03-10: V3.1.1 修复选中颜色不显示
|
* 2022-03-10: V3.1.1 修复选中颜色不显示
|
||||||
* 2024-08-05: V3.6.8 增加ShowDropDown()函数
|
* 2024-08-05: V3.6.8 增加ShowDropDown()函数
|
||||||
|
* 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
* 文件名称: UIColorPicker.cs
|
* 文件名称: UIColorPicker.cs
|
||||||
* 文件说明: Color picker with color wheel and eye dropper
|
* 文件说明: Color picker with color wheel and eye dropper
|
||||||
@ -40,6 +41,7 @@ namespace Sunny.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultProperty("ValueChanged")]
|
[DefaultProperty("ValueChanged")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("颜色选择框控件")]
|
||||||
public sealed class UIColorPicker : UIDropControl
|
public sealed class UIColorPicker : UIDropControl
|
||||||
{
|
{
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
@ -76,7 +78,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public override string[] FormTranslatorProperties { get; }
|
public override string[] FormTranslatorProperties => null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 颜色改变事件
|
/// 颜色改变事件
|
||||||
@ -110,6 +112,7 @@ namespace Sunny.UI
|
|||||||
item.SelectedColor = Value;
|
item.SelectedColor = Value;
|
||||||
item.Translate();
|
item.Translate();
|
||||||
item.SetDPIScale();
|
item.SetDPIScale();
|
||||||
|
if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
|
||||||
ItemForm.Show(this);
|
ItemForm.Show(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -40,6 +40,10 @@
|
|||||||
* 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text
|
* 2023-08-11: V3.4.1 Items.Clear后,DropDownStyle为DropDown时,不清空Text
|
||||||
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
|
* 2023-12-26: V3.6.2 增加下拉界面的滚动条设置
|
||||||
* 2024-01-27: V3.6.3 修复在窗体构造函数设置SelectedIndex报错
|
* 2024-01-27: V3.6.3 修复在窗体构造函数设置SelectedIndex报错
|
||||||
|
* 2024-10-28: V3.7.2 增加了SelectionChangeCommitted事件,下拉框显示鼠标点击条目时响应
|
||||||
|
* 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
|
||||||
|
* 2024-11-10: V3.7.2 删除ScrollBarColor、ScrollBarBackColor、ScrollBarStyleInherited属性
|
||||||
|
* 2025-03-18: V3.8.2 修复过滤下拉框跟随主题配色
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -57,6 +61,7 @@ namespace Sunny.UI
|
|||||||
[DefaultProperty("Items")]
|
[DefaultProperty("Items")]
|
||||||
[DefaultEvent("SelectedIndexChanged")]
|
[DefaultEvent("SelectedIndexChanged")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("组合框控件")]
|
||||||
[LookupBindingProperties("DataSource", "DisplayMember", "ValueMember", "SelectedValue")]
|
[LookupBindingProperties("DataSource", "DisplayMember", "ValueMember", "SelectedValue")]
|
||||||
public sealed partial class UIComboBox : UIDropControl, IToolTip, IHideDropDown
|
public sealed partial class UIComboBox : UIDropControl, IToolTip, IHideDropDown
|
||||||
{
|
{
|
||||||
@ -71,6 +76,7 @@ namespace Sunny.UI
|
|||||||
ListBox.SelectedValueChanged += ListBox_SelectedValueChanged;
|
ListBox.SelectedValueChanged += ListBox_SelectedValueChanged;
|
||||||
ListBox.ItemsClear += ListBox_ItemsClear;
|
ListBox.ItemsClear += ListBox_ItemsClear;
|
||||||
ListBox.ItemsRemove += ListBox_ItemsRemove;
|
ListBox.ItemsRemove += ListBox_ItemsRemove;
|
||||||
|
ListBox.MouseClick += ListBox_MouseClick;
|
||||||
|
|
||||||
filterForm.BeforeListClick += ListBox_Click;
|
filterForm.BeforeListClick += ListBox_Click;
|
||||||
|
|
||||||
@ -82,8 +88,21 @@ namespace Sunny.UI
|
|||||||
CreateInstance();
|
CreateInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ListBox_MouseClick(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
//SelectionChangeCommitted
|
||||||
|
UIListBox listBox = (UIListBox)sender;
|
||||||
|
int index = listBox.IndexFromPoint(e.X, e.Y);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
SelectionChangeCommitted?.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler SelectionChangeCommitted;
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public override string[] FormTranslatorProperties { get; }
|
public override string[] FormTranslatorProperties => null;
|
||||||
|
|
||||||
[DefaultValue(0), Category("SunnyUI"), Description("垂直滚动条宽度,最小为原生滚动条宽度")]
|
[DefaultValue(0), Category("SunnyUI"), Description("垂直滚动条宽度,最小为原生滚动条宽度")]
|
||||||
public int ScrollBarWidth
|
public int ScrollBarWidth
|
||||||
@ -99,38 +118,6 @@ namespace Sunny.UI
|
|||||||
set => ListBox.ScrollBarHandleWidth = value;
|
set => ListBox.ScrollBarHandleWidth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
|
||||||
/// </summary>
|
|
||||||
[Description("滚动条填充颜色"), Category("SunnyUI")]
|
|
||||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
|
||||||
public Color ScrollBarColor
|
|
||||||
{
|
|
||||||
get => ListBox.ScrollBarColor;
|
|
||||||
set => ListBox.ScrollBarColor = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
|
||||||
/// </summary>
|
|
||||||
[Description("滚动条背景颜色"), Category("SunnyUI")]
|
|
||||||
[DefaultValue(typeof(Color), "243, 249, 255")]
|
|
||||||
public Color ScrollBarBackColor
|
|
||||||
{
|
|
||||||
get => ListBox.ScrollBarBackColor;
|
|
||||||
set => ListBox.ScrollBarBackColor = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 滚动条主题样式
|
|
||||||
/// </summary>
|
|
||||||
[DefaultValue(true), Description("滚动条主题样式"), Category("SunnyUI")]
|
|
||||||
public bool ScrollBarStyleInherited
|
|
||||||
{
|
|
||||||
get => ListBox.ScrollBarStyleInherited;
|
|
||||||
set => ListBox.ScrollBarStyleInherited = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
[Description("显示清除按钮"), Category("SunnyUI")]
|
[Description("显示清除按钮"), Category("SunnyUI")]
|
||||||
public bool ShowClearButton
|
public bool ShowClearButton
|
||||||
@ -171,6 +158,11 @@ namespace Sunny.UI
|
|||||||
FilterItemForm.AutoClose = false;
|
FilterItemForm.AutoClose = false;
|
||||||
if (!FilterItemForm.Visible)
|
if (!FilterItemForm.Visible)
|
||||||
{
|
{
|
||||||
|
filterForm.Style = StyleDropDown;
|
||||||
|
if (StyleDropDown != UIStyle.Inherited)
|
||||||
|
filterForm.Style = StyleDropDown;
|
||||||
|
else
|
||||||
|
filterForm.Style = UIStyles.Style;
|
||||||
FilterItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, CalcItemFormHeight()));
|
FilterItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, CalcItemFormHeight()));
|
||||||
edit.Focus();
|
edit.Focus();
|
||||||
}
|
}
|
||||||
@ -742,11 +734,13 @@ namespace Sunny.UI
|
|||||||
dropWidth = Math.Max(DropDownWidth, dropWidth);
|
dropWidth = Math.Max(DropDownWidth, dropWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StyleDropDown != UIStyle.Inherited) dropForm.Style = StyleDropDown;
|
||||||
ItemForm.Show(this, new Size(dropWidth, CalcItemFormHeight()));
|
ItemForm.Show(this, new Size(dropWidth, CalcItemFormHeight()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (StyleDropDown != UIStyle.Inherited) filterForm.Style = StyleDropDown;
|
||||||
if (FilterItemForm.Visible)
|
if (FilterItemForm.Visible)
|
||||||
{
|
{
|
||||||
FilterItemForm.Close();
|
FilterItemForm.Close();
|
||||||
@ -968,7 +962,7 @@ namespace Sunny.UI
|
|||||||
public Color ItemRectColor
|
public Color ItemRectColor
|
||||||
{
|
{
|
||||||
get => ListBox.RectColor;
|
get => ListBox.RectColor;
|
||||||
set => ListBox.RectColor = value;
|
set => FilterListBox.RectColor = ListBox.RectColor = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -30,6 +30,10 @@
|
|||||||
* 2023-07-25: V3.4.1 过滤输入后,按键盘下键切换至DataGridView,选中数据后按回车可快捷选中数据
|
* 2023-07-25: V3.4.1 过滤输入后,按键盘下键切换至DataGridView,选中数据后按回车可快捷选中数据
|
||||||
* 2023-09-25: V3.5.0 增加ClearFilter,可以清除弹窗的搜索栏文字
|
* 2023-09-25: V3.5.0 增加ClearFilter,可以清除弹窗的搜索栏文字
|
||||||
* 2024-03-22: V3.6.5 增加ShowDropDown()
|
* 2024-03-22: V3.6.5 增加ShowDropDown()
|
||||||
|
* 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
|
||||||
|
* 2024-11-12: V3.7.2 增加下拉框滚动条宽度调整属性
|
||||||
|
* 2024-11-28: V3.8.0 解决下拉框显示过滤编辑框不能一直显示 #IB7AFB
|
||||||
|
* 2024-12-04: V3.8.0 修复一个报错 #IB8YK9
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -42,6 +46,7 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
[DefaultProperty("ValueChanged")]
|
[DefaultProperty("ValueChanged")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("表格列表框控件")]
|
||||||
public class UIComboDataGridView : UIDropControl, IToolTip
|
public class UIComboDataGridView : UIDropControl, IToolTip
|
||||||
{
|
{
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
@ -78,7 +83,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public override string[] FormTranslatorProperties { get; }
|
public override string[] FormTranslatorProperties => null;
|
||||||
|
|
||||||
[DefaultValue(true), Description("过滤框输入逐一过滤"), Category("SunnyUI")]
|
[DefaultValue(true), Description("过滤框输入逐一过滤"), Category("SunnyUI")]
|
||||||
public bool Filter1by1 { get; set; } = true;
|
public bool Filter1by1 { get; set; } = true;
|
||||||
@ -107,11 +112,26 @@ namespace Sunny.UI
|
|||||||
item.SetDPIScale();
|
item.SetDPIScale();
|
||||||
item.Translate();
|
item.Translate();
|
||||||
item.Filter1by1 = Filter1by1;
|
item.Filter1by1 = Filter1by1;
|
||||||
|
if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
|
||||||
//ItemForm.Show(this);
|
//ItemForm.Show(this);
|
||||||
ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, DropDownHeight));
|
ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, DropDownHeight));
|
||||||
item.ComboDataGridViewFilterChanged += Item_ComboDataGridViewFilterChanged;
|
item.ComboDataGridViewFilterChanged += Item_ComboDataGridViewFilterChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(0), Category("SunnyUI"), Description("垂直滚动条宽度,最小为原生滚动条宽度")]
|
||||||
|
public int ScrollBarWidth
|
||||||
|
{
|
||||||
|
get => DataGridView.ScrollBarWidth;
|
||||||
|
set => DataGridView.ScrollBarWidth = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DefaultValue(6), Category("SunnyUI"), Description("垂直滚动条滑块宽度,最小为原生滚动条宽度")]
|
||||||
|
public int ScrollBarHandleWidth
|
||||||
|
{
|
||||||
|
get => DataGridView.ScrollBarHandleWidth;
|
||||||
|
set => DataGridView.ScrollBarHandleWidth = value;
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowDropDown()
|
public void ShowDropDown()
|
||||||
{
|
{
|
||||||
UIComboDataGridView_ButtonClick(this, EventArgs.Empty);
|
UIComboDataGridView_ButtonClick(this, EventArgs.Empty);
|
||||||
@ -154,8 +174,8 @@ namespace Sunny.UI
|
|||||||
return edit;
|
return edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(true), Description("下拉框显示过滤编辑框"), Category("SunnyUI")]
|
||||||
public bool ShowFilter { get; set; }
|
public bool ShowFilter { get; set; } = true;
|
||||||
|
|
||||||
private readonly UIComboDataGridViewItem item = new UIComboDataGridViewItem();
|
private readonly UIComboDataGridViewItem item = new UIComboDataGridViewItem();
|
||||||
|
|
||||||
@ -190,7 +210,7 @@ namespace Sunny.UI
|
|||||||
if (ShowFilter)
|
if (ShowFilter)
|
||||||
ValueChanged?.Invoke(this, value);
|
ValueChanged?.Invoke(this, value);
|
||||||
else
|
else
|
||||||
SelectIndexChange(this, value.ToString().ToInt());
|
SelectIndexChange?.Invoke(this, value.ToString().ToInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -27,6 +27,7 @@
|
|||||||
* 2023-06-12: V3.3.8 修复使用清空按钮后,再次打开下拉框,上次的选择内容还是存在
|
* 2023-06-12: V3.3.8 修复使用清空按钮后,再次打开下拉框,上次的选择内容还是存在
|
||||||
* 2024-03-22: V3.6.5 增加ShowDropDown()
|
* 2024-03-22: V3.6.5 增加ShowDropDown()
|
||||||
* 2024-07-13: V3.6.7 修改下拉框全选按钮跟随主题,修改一处内置国际化翻译
|
* 2024-07-13: V3.6.7 修改下拉框全选按钮跟随主题,修改一处内置国际化翻译
|
||||||
|
* 2024-11-10: V3.7.2 增加StyleDropDown属性,手动修改Style时设置此属性以修改下拉框主题
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -40,6 +41,7 @@ namespace Sunny.UI
|
|||||||
[DefaultEvent("NodeSelected")]
|
[DefaultEvent("NodeSelected")]
|
||||||
[DefaultProperty("Nodes")]
|
[DefaultProperty("Nodes")]
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
|
[Description("树形列表框控件")]
|
||||||
public class UIComboTreeView : UIDropControl, IToolTip
|
public class UIComboTreeView : UIDropControl, IToolTip
|
||||||
{
|
{
|
||||||
public UIComboTreeView()
|
public UIComboTreeView()
|
||||||
@ -85,7 +87,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public override string[] FormTranslatorProperties { get; }
|
public override string[] FormTranslatorProperties => null;
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
[Description("显示清除按钮"), Category("SunnyUI")]
|
[Description("显示清除按钮"), Category("SunnyUI")]
|
||||||
@ -260,6 +262,7 @@ namespace Sunny.UI
|
|||||||
item.Translate();
|
item.Translate();
|
||||||
item.SetDPIScale();
|
item.SetDPIScale();
|
||||||
//ItemForm.Show(this);
|
//ItemForm.Show(this);
|
||||||
|
if (StyleDropDown != UIStyle.Inherited) item.Style = StyleDropDown;
|
||||||
int width = DropDownWidth < Width ? Width : DropDownWidth;
|
int width = DropDownWidth < Width ? Width : DropDownWidth;
|
||||||
width = Math.Max(250, width);
|
width = Math.Max(250, width);
|
||||||
item.ShowSelectedAllCheckBox = ShowSelectedAllCheckBox;
|
item.ShowSelectedAllCheckBox = ShowSelectedAllCheckBox;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -31,6 +31,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
|
[Description("上下文菜单")]
|
||||||
public sealed class UIContextMenuStrip : ContextMenuStrip, IStyleInterface, IZoomScale
|
public sealed class UIContextMenuStrip : ContextMenuStrip, IStyleInterface, IZoomScale
|
||||||
{
|
{
|
||||||
private ContextMenuColorTable ColorTable = new ContextMenuColorTable();
|
private ContextMenuColorTable ColorTable = new ContextMenuColorTable();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
* SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
|
||||||
* CopyRight (C) 2012-2024 ShenYongHua(沈永华).
|
* CopyRight (C) 2012-2025 ShenYongHua(沈永华).
|
||||||
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
* QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
|
||||||
*
|
*
|
||||||
* Blog: https://www.cnblogs.com/yhuse
|
* Blog: https://www.cnblogs.com/yhuse
|
||||||
@ -56,7 +56,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
[Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")]
|
[Description("控件在界面显示时需要多语翻译的属性名称数组"), Category("SunnyUI")]
|
||||||
public virtual string[] FormTranslatorProperties { get; }
|
public virtual string[] FormTranslatorProperties => null;
|
||||||
|
|
||||||
[DefaultValue(true)]
|
[DefaultValue(true)]
|
||||||
[Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")]
|
[Description("控件在界面显示时需要多语翻译"), Category("SunnyUI")]
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user