* UIStyle: 修复了几个可能引起自适应产生的问题。
This commit is contained in:
parent
dd529fa203
commit
219e8a6498
@ -2,3 +2,6 @@
|
|||||||
|
|
||||||
# IDE0090: 使用 "new(...)"
|
# IDE0090: 使用 "new(...)"
|
||||||
dotnet_diagnostic.IDE0090.severity = none
|
dotnet_diagnostic.IDE0090.severity = none
|
||||||
|
|
||||||
|
# CA1416: 验证平台兼容性
|
||||||
|
dotnet_diagnostic.CA1416.severity = none
|
Binary file not shown.
@ -376,7 +376,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
if (con.Controls.Count > 0)
|
if (con.Controls.Count > 0)
|
||||||
{
|
{
|
||||||
list.AddRange(GetAllControls(con));
|
list.AddRange(GetAllDPIScaleControls(con));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
#pragma warning disable CA1416 // 验证平台兼容性
|
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
public static class UEnvironment
|
public static class UEnvironment
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
* 2020-01-01: V2.2.0 增加文件说明
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#pragma warning disable CA1416 // 验证平台兼容性
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
@ -44,7 +44,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private int angle;
|
private int angle;
|
||||||
|
|
||||||
[DefaultValue(0),Category("SunnyUI"),Description("居中时旋转角度")]
|
[DefaultValue(0), Category("SunnyUI"), Description("居中时旋转角度")]
|
||||||
public int Angle
|
public int Angle
|
||||||
{
|
{
|
||||||
get => angle;
|
get => angle;
|
||||||
@ -56,7 +56,7 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public bool IsScaled { get; private set; }
|
public bool IsScaled { get; set; }
|
||||||
|
|
||||||
public void SetDPIScale()
|
public void SetDPIScale()
|
||||||
{
|
{
|
||||||
|
@ -117,30 +117,67 @@ namespace Sunny.UI
|
|||||||
Translate();
|
Translate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Translate()
|
protected override void OnFontChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
b0.Text = UILocalize.Prev;
|
base.OnFontChanged(e);
|
||||||
b16.Text = UILocalize.Next;
|
foreach (var item in this.GetControls<UISymbolButton>(true))
|
||||||
btnSelect.Text = UILocalize.SelectTitle;
|
|
||||||
|
|
||||||
using (Font tmpFont = this.DPIScaleFont(b0.Font))
|
|
||||||
{
|
{
|
||||||
SizeF sf = b0.CreateGraphics().MeasureString(b0.Text, tmpFont);
|
item.IsScaled = true;
|
||||||
b0.Width = b0.SymbolSize + (int)sf.Width + 10;
|
item.Font = Font;
|
||||||
|
|
||||||
sf = b16.CreateGraphics().MeasureString(b16.Text, tmpFont);
|
|
||||||
b16.Width = b16.SymbolSize + (int)sf.Width + 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
btnSelect.Width = (int)btnSelect.CreateGraphics().MeasureString(btnSelect.Text, btnSelect.Font).Width + 16;
|
foreach (var item in this.GetControls<UITextBox>(true))
|
||||||
|
{
|
||||||
|
item.IsScaled = true;
|
||||||
|
item.Font = Font;
|
||||||
|
}
|
||||||
|
|
||||||
uiLabel1.Text = UILocalize.SelectPageLeft;
|
foreach (var item in this.GetControls<UIComboBox>(true))
|
||||||
uiLabel2.Text = UILocalize.SelectPageRight;
|
{
|
||||||
edtPage.Left = uiLabel1.Right + 3;
|
item.IsScaled = true;
|
||||||
uiLabel2.Left = edtPage.Right + 3;
|
item.Font = Font;
|
||||||
btnSelect.Left = uiLabel2.Right + 3;
|
}
|
||||||
p1.Width = btnSelect.Right + 3;
|
|
||||||
SetShowButtons();
|
foreach (var item in this.GetControls<UILabel>(true))
|
||||||
|
{
|
||||||
|
item.IsScaled = true;
|
||||||
|
item.Font = Font;
|
||||||
|
}
|
||||||
|
|
||||||
|
Translate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Translate()
|
||||||
|
{
|
||||||
|
if (b0 == null) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
b0.Text = UILocalize.Prev;
|
||||||
|
b16.Text = UILocalize.Next;
|
||||||
|
btnSelect.Text = UILocalize.SelectTitle;
|
||||||
|
|
||||||
|
SizeF sf = b0.CreateGraphics().MeasureString(b0.Text, b0.Font);
|
||||||
|
b0.Width = b0.SymbolSize + (int)sf.Width + 10;
|
||||||
|
|
||||||
|
sf = b16.CreateGraphics().MeasureString(b16.Text, b0.Font);
|
||||||
|
b16.Width = b16.SymbolSize + (int)sf.Width + 10;
|
||||||
|
|
||||||
|
btnSelect.Width = (int)btnSelect.CreateGraphics().MeasureString(btnSelect.Text, btnSelect.Font).Width + 16;
|
||||||
|
|
||||||
|
uiLabel1.Text = UILocalize.SelectPageLeft;
|
||||||
|
uiLabel2.Text = UILocalize.SelectPageRight;
|
||||||
|
edtPage.Left = uiLabel1.Right + 3;
|
||||||
|
uiLabel2.Left = edtPage.Right + 3;
|
||||||
|
btnSelect.Left = uiLabel2.Right + 3;
|
||||||
|
p1.Width = btnSelect.Right + 3;
|
||||||
|
|
||||||
|
SetShowButtons();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int buttonInterval = 4;
|
private int buttonInterval = 4;
|
||||||
@ -349,6 +386,7 @@ namespace Sunny.UI
|
|||||||
this.b0.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b0.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b0.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b0.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.b0.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.b0.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
|
this.b0.IsScaled = false;
|
||||||
this.b0.Location = new System.Drawing.Point(3, 3);
|
this.b0.Location = new System.Drawing.Point(3, 3);
|
||||||
this.b0.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b0.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b0.Name = "b0";
|
this.b0.Name = "b0";
|
||||||
@ -366,6 +404,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b1.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b1.IsScaled = false;
|
||||||
this.b1.Location = new System.Drawing.Point(81, 3);
|
this.b1.Location = new System.Drawing.Point(81, 3);
|
||||||
this.b1.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b1.Name = "b1";
|
this.b1.Name = "b1";
|
||||||
@ -379,6 +418,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b3.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b3.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b3.IsScaled = false;
|
||||||
this.b3.Location = new System.Drawing.Point(145, 3);
|
this.b3.Location = new System.Drawing.Point(145, 3);
|
||||||
this.b3.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b3.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b3.Name = "b3";
|
this.b3.Name = "b3";
|
||||||
@ -392,6 +432,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b2.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b2.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b2.IsScaled = false;
|
||||||
this.b2.Location = new System.Drawing.Point(113, 3);
|
this.b2.Location = new System.Drawing.Point(113, 3);
|
||||||
this.b2.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b2.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b2.Name = "b2";
|
this.b2.Name = "b2";
|
||||||
@ -405,6 +446,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b7.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b7.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b7.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b7.IsScaled = false;
|
||||||
this.b7.Location = new System.Drawing.Point(273, 3);
|
this.b7.Location = new System.Drawing.Point(273, 3);
|
||||||
this.b7.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b7.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b7.Name = "b7";
|
this.b7.Name = "b7";
|
||||||
@ -418,6 +460,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b6.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b6.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b6.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b6.IsScaled = false;
|
||||||
this.b6.Location = new System.Drawing.Point(241, 3);
|
this.b6.Location = new System.Drawing.Point(241, 3);
|
||||||
this.b6.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b6.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b6.Name = "b6";
|
this.b6.Name = "b6";
|
||||||
@ -431,6 +474,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b5.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b5.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b5.IsScaled = false;
|
||||||
this.b5.Location = new System.Drawing.Point(209, 3);
|
this.b5.Location = new System.Drawing.Point(209, 3);
|
||||||
this.b5.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b5.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b5.Name = "b5";
|
this.b5.Name = "b5";
|
||||||
@ -444,6 +488,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b4.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b4.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b4.IsScaled = false;
|
||||||
this.b4.Location = new System.Drawing.Point(177, 3);
|
this.b4.Location = new System.Drawing.Point(177, 3);
|
||||||
this.b4.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b4.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b4.Name = "b4";
|
this.b4.Name = "b4";
|
||||||
@ -457,6 +502,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b15.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b15.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b15.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b15.IsScaled = false;
|
||||||
this.b15.Location = new System.Drawing.Point(529, 3);
|
this.b15.Location = new System.Drawing.Point(529, 3);
|
||||||
this.b15.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b15.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b15.Name = "b15";
|
this.b15.Name = "b15";
|
||||||
@ -470,6 +516,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b14.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b14.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b14.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b14.IsScaled = false;
|
||||||
this.b14.Location = new System.Drawing.Point(497, 3);
|
this.b14.Location = new System.Drawing.Point(497, 3);
|
||||||
this.b14.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b14.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b14.Name = "b14";
|
this.b14.Name = "b14";
|
||||||
@ -483,6 +530,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b13.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b13.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b13.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b13.IsScaled = false;
|
||||||
this.b13.Location = new System.Drawing.Point(465, 3);
|
this.b13.Location = new System.Drawing.Point(465, 3);
|
||||||
this.b13.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b13.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b13.Name = "b13";
|
this.b13.Name = "b13";
|
||||||
@ -496,6 +544,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b12.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b12.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b12.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b12.IsScaled = false;
|
||||||
this.b12.Location = new System.Drawing.Point(433, 3);
|
this.b12.Location = new System.Drawing.Point(433, 3);
|
||||||
this.b12.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b12.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b12.Name = "b12";
|
this.b12.Name = "b12";
|
||||||
@ -509,6 +558,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b11.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b11.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b11.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b11.IsScaled = false;
|
||||||
this.b11.Location = new System.Drawing.Point(401, 3);
|
this.b11.Location = new System.Drawing.Point(401, 3);
|
||||||
this.b11.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b11.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b11.Name = "b11";
|
this.b11.Name = "b11";
|
||||||
@ -522,6 +572,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b10.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b10.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b10.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b10.IsScaled = false;
|
||||||
this.b10.Location = new System.Drawing.Point(369, 3);
|
this.b10.Location = new System.Drawing.Point(369, 3);
|
||||||
this.b10.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b10.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b10.Name = "b10";
|
this.b10.Name = "b10";
|
||||||
@ -535,6 +586,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b9.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b9.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b9.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b9.IsScaled = false;
|
||||||
this.b9.Location = new System.Drawing.Point(337, 3);
|
this.b9.Location = new System.Drawing.Point(337, 3);
|
||||||
this.b9.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b9.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b9.Name = "b9";
|
this.b9.Name = "b9";
|
||||||
@ -548,6 +600,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.b8.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b8.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b8.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.b8.IsScaled = false;
|
||||||
this.b8.Location = new System.Drawing.Point(305, 3);
|
this.b8.Location = new System.Drawing.Point(305, 3);
|
||||||
this.b8.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b8.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b8.Name = "b8";
|
this.b8.Name = "b8";
|
||||||
@ -562,6 +615,7 @@ namespace Sunny.UI
|
|||||||
this.b16.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.b16.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.b16.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.b16.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.b16.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
this.b16.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
|
this.b16.IsScaled = false;
|
||||||
this.b16.Location = new System.Drawing.Point(561, 3);
|
this.b16.Location = new System.Drawing.Point(561, 3);
|
||||||
this.b16.MinimumSize = new System.Drawing.Size(1, 1);
|
this.b16.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.b16.Name = "b16";
|
this.b16.Name = "b16";
|
||||||
@ -583,12 +637,13 @@ namespace Sunny.UI
|
|||||||
this.p1.Controls.Add(this.uiLabel2);
|
this.p1.Controls.Add(this.uiLabel2);
|
||||||
this.p1.Controls.Add(this.uiLabel1);
|
this.p1.Controls.Add(this.uiLabel1);
|
||||||
this.p1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.p1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.p1.IsScaled = false;
|
||||||
this.p1.Location = new System.Drawing.Point(727, 3);
|
this.p1.Location = new System.Drawing.Point(727, 3);
|
||||||
this.p1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.p1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.p1.MinimumSize = new System.Drawing.Size(1, 1);
|
this.p1.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.p1.Name = "p1";
|
this.p1.Name = "p1";
|
||||||
this.p1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
this.p1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
||||||
this.p1.Size = new System.Drawing.Size(176, 29);
|
this.p1.Size = new System.Drawing.Size(216, 29);
|
||||||
this.p1.TabIndex = 17;
|
this.p1.TabIndex = 17;
|
||||||
this.p1.Text = null;
|
this.p1.Text = null;
|
||||||
this.p1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
this.p1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@ -596,12 +651,13 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
// edtPage
|
// edtPage
|
||||||
//
|
//
|
||||||
|
this.edtPage.ButtonSymbol = 61761;
|
||||||
this.edtPage.Cursor = System.Windows.Forms.Cursors.IBeam;
|
this.edtPage.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||||
this.edtPage.DoubleValue = 10D;
|
this.edtPage.DoubleValue = 10D;
|
||||||
this.edtPage.FillColor = System.Drawing.Color.White;
|
|
||||||
this.edtPage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.edtPage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.edtPage.HasMinimum = true;
|
this.edtPage.HasMinimum = true;
|
||||||
this.edtPage.IntValue = 10;
|
this.edtPage.IntValue = 10;
|
||||||
|
this.edtPage.IsScaled = false;
|
||||||
this.edtPage.Location = new System.Drawing.Point(28, 0);
|
this.edtPage.Location = new System.Drawing.Point(28, 0);
|
||||||
this.edtPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
this.edtPage.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||||
this.edtPage.Maximum = 2147483647D;
|
this.edtPage.Maximum = 2147483647D;
|
||||||
@ -620,6 +676,7 @@ namespace Sunny.UI
|
|||||||
//
|
//
|
||||||
this.btnSelect.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.btnSelect.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.btnSelect.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.btnSelect.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.btnSelect.IsScaled = false;
|
||||||
this.btnSelect.Location = new System.Drawing.Point(111, 0);
|
this.btnSelect.Location = new System.Drawing.Point(111, 0);
|
||||||
this.btnSelect.MinimumSize = new System.Drawing.Size(1, 1);
|
this.btnSelect.MinimumSize = new System.Drawing.Size(1, 1);
|
||||||
this.btnSelect.Name = "btnSelect";
|
this.btnSelect.Name = "btnSelect";
|
||||||
@ -634,9 +691,10 @@ namespace Sunny.UI
|
|||||||
this.uiLabel2.AutoSize = true;
|
this.uiLabel2.AutoSize = true;
|
||||||
this.uiLabel2.BackColor = System.Drawing.Color.Transparent;
|
this.uiLabel2.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.uiLabel2.IsScaled = false;
|
||||||
this.uiLabel2.Location = new System.Drawing.Point(81, 4);
|
this.uiLabel2.Location = new System.Drawing.Point(81, 4);
|
||||||
this.uiLabel2.Name = "uiLabel2";
|
this.uiLabel2.Name = "uiLabel2";
|
||||||
this.uiLabel2.Size = new System.Drawing.Size(23, 20);
|
this.uiLabel2.Size = new System.Drawing.Size(33, 28);
|
||||||
this.uiLabel2.TabIndex = 2;
|
this.uiLabel2.TabIndex = 2;
|
||||||
this.uiLabel2.Text = "页";
|
this.uiLabel2.Text = "页";
|
||||||
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
@ -646,9 +704,10 @@ namespace Sunny.UI
|
|||||||
this.uiLabel1.AutoSize = true;
|
this.uiLabel1.AutoSize = true;
|
||||||
this.uiLabel1.BackColor = System.Drawing.Color.Transparent;
|
this.uiLabel1.BackColor = System.Drawing.Color.Transparent;
|
||||||
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.uiLabel1.IsScaled = false;
|
||||||
this.uiLabel1.Location = new System.Drawing.Point(5, 4);
|
this.uiLabel1.Location = new System.Drawing.Point(5, 4);
|
||||||
this.uiLabel1.Name = "uiLabel1";
|
this.uiLabel1.Name = "uiLabel1";
|
||||||
this.uiLabel1.Size = new System.Drawing.Size(23, 20);
|
this.uiLabel1.Size = new System.Drawing.Size(33, 28);
|
||||||
this.uiLabel1.TabIndex = 0;
|
this.uiLabel1.TabIndex = 0;
|
||||||
this.uiLabel1.Text = "第";
|
this.uiLabel1.Text = "第";
|
||||||
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||||
@ -659,6 +718,7 @@ namespace Sunny.UI
|
|||||||
this.cb1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
this.cb1.DropDownStyle = Sunny.UI.UIDropDownStyle.DropDownList;
|
||||||
this.cb1.FillColor = System.Drawing.Color.White;
|
this.cb1.FillColor = System.Drawing.Color.White;
|
||||||
this.cb1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.cb1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.cb1.IsScaled = false;
|
||||||
this.cb1.Items.AddRange(new object[] {
|
this.cb1.Items.AddRange(new object[] {
|
||||||
"20条/页",
|
"20条/页",
|
||||||
"50条/页",
|
"50条/页",
|
||||||
|
@ -507,7 +507,7 @@ namespace Sunny.UI
|
|||||||
private void CalcEditHeight()
|
private void CalcEditHeight()
|
||||||
{
|
{
|
||||||
TextBox edt = new();
|
TextBox edt = new();
|
||||||
edt.Font = edit.Font;
|
edt.Font = edit.Font.DPIScaleFont();
|
||||||
MinHeight = edt.PreferredHeight;
|
MinHeight = edt.PreferredHeight;
|
||||||
edt.BorderStyle = BorderStyle.None;
|
edt.BorderStyle = BorderStyle.None;
|
||||||
MaxHeight = edt.PreferredHeight * 2 + MinHeight - edt.PreferredHeight;
|
MaxHeight = edt.PreferredHeight * 2 + MinHeight - edt.PreferredHeight;
|
||||||
|
@ -43,42 +43,42 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
private readonly UIEditOption Option;
|
private readonly UIEditOption Option;
|
||||||
|
|
||||||
public UIEditForm(UIEditOption option)
|
protected override void OnShown(EventArgs e)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
base.OnShown(e);
|
||||||
|
|
||||||
btnOK.Text = UILocalize.OK;
|
}
|
||||||
btnCancel.Text = UILocalize.Cancel;
|
|
||||||
|
|
||||||
Option = option;
|
private void InitEditor()
|
||||||
if (option == null || option.Infos.Count == 0) return;
|
{
|
||||||
|
if (Option == null || Option.Infos.Count == 0) return;
|
||||||
|
|
||||||
base.Text = option.Text;
|
base.Text = Option.Text;
|
||||||
int top = 55;
|
int top = 55;
|
||||||
|
|
||||||
List<Control> ctrls = new List<Control>();
|
List<Control> ctrls = new List<Control>();
|
||||||
|
|
||||||
if (option.AutoLabelWidth)
|
if (Option.AutoLabelWidth)
|
||||||
{
|
{
|
||||||
float size = 0;
|
float size = 0;
|
||||||
foreach (var info in option.Infos)
|
foreach (var info in Option.Infos)
|
||||||
{
|
{
|
||||||
SizeF sf = info.Text.MeasureString(UIFontColor.Font);
|
SizeF sf = info.Text.MeasureString(UIFontColor.Font);
|
||||||
size = Math.Max(sf.Width, size);
|
size = Math.Max(sf.Width, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
option.LabelWidth = (int)size + 1 + 50;
|
Option.LabelWidth = (int)size + 1 + 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
Width = option.LabelWidth + option.ValueWidth + 28;
|
Width = Option.LabelWidth + Option.ValueWidth + 28;
|
||||||
|
|
||||||
foreach (var info in option.Infos)
|
foreach (var info in Option.Infos)
|
||||||
{
|
{
|
||||||
UILabel label = new UILabel();
|
UILabel label = new UILabel();
|
||||||
label.Text = info.Text;
|
label.Text = info.Text;
|
||||||
label.AutoSize = false;
|
label.AutoSize = false;
|
||||||
label.Left = 5;
|
label.Left = 5;
|
||||||
label.Width = option.LabelWidth - 25;
|
label.Width = Option.LabelWidth - 25;
|
||||||
label.Height = 29;
|
label.Height = 29;
|
||||||
label.Top = top;
|
label.Top = top;
|
||||||
label.TextAlign = ContentAlignment.MiddleRight;
|
label.TextAlign = ContentAlignment.MiddleRight;
|
||||||
@ -212,9 +212,9 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
if (ctrl != null)
|
if (ctrl != null)
|
||||||
{
|
{
|
||||||
ctrl.Left = option.LabelWidth;
|
ctrl.Left = Option.LabelWidth;
|
||||||
if (info.EditType != EditType.Switch)
|
if (info.EditType != EditType.Switch)
|
||||||
ctrl.Width = info.HalfWidth ? option.ValueWidth / 2 : option.ValueWidth;
|
ctrl.Width = info.HalfWidth ? Option.ValueWidth / 2 : Option.ValueWidth;
|
||||||
ctrl.Top = top;
|
ctrl.Top = top;
|
||||||
ctrl.Parent = this;
|
ctrl.Parent = this;
|
||||||
ctrl.Name = "Edit_" + info.DataPropertyName;
|
ctrl.Name = "Edit_" + info.DataPropertyName;
|
||||||
@ -243,6 +243,17 @@ namespace Sunny.UI
|
|||||||
btnOK.ShowFocusLine = btnCancel.ShowFocusLine = true;
|
btnOK.ShowFocusLine = btnCancel.ShowFocusLine = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UIEditForm(UIEditOption option)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
btnOK.Text = UILocalize.OK;
|
||||||
|
btnCancel.Text = UILocalize.Cancel;
|
||||||
|
|
||||||
|
Option = option;
|
||||||
|
InitEditor();
|
||||||
|
}
|
||||||
|
|
||||||
public object this[string dataPropertyName]
|
public object this[string dataPropertyName]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
Loading…
x
Reference in New Issue
Block a user