* UILoginForm: 将文本资源放入窗体属性

This commit is contained in:
Sunny 2022-05-11 23:53:37 +08:00
parent 5a22a14fc5
commit 840771c0a4
3 changed files with 70 additions and 35 deletions

View File

@ -132,7 +132,7 @@ namespace Sunny.UI
/// Delays the specified ms. /// Delays the specified ms.
/// </summary> /// </summary>
/// <param name="ms">The ms.</param> /// <param name="ms">The ms.</param>
public static void Sleep(int ms) public static void Delay(int ms)
{ {
var sw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew();
var sleepMs = ms - 16; var sleepMs = ms - 16;

View File

@ -36,7 +36,6 @@
this.btnCancel = new Sunny.UI.UISymbolButton(); this.btnCancel = new Sunny.UI.UISymbolButton();
this.lblTitle = new Sunny.UI.UILabel(); this.lblTitle = new Sunny.UI.UILabel();
this.lblSubText = new Sunny.UI.UILabel(); this.lblSubText = new Sunny.UI.UILabel();
this.uiLabel1 = new Sunny.UI.UILabel();
this.uiPanel1 = new Sunny.UI.UIPanel(); this.uiPanel1 = new Sunny.UI.UIPanel();
this.uiPanel1.SuspendLayout(); this.uiPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -52,31 +51,36 @@
this.uiAvatar1.Style = Sunny.UI.UIStyle.Custom; this.uiAvatar1.Style = Sunny.UI.UIStyle.Custom;
this.uiAvatar1.TabIndex = 4; this.uiAvatar1.TabIndex = 4;
this.uiAvatar1.Text = "uiAvatar1"; this.uiAvatar1.Text = "uiAvatar1";
this.uiAvatar1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// uiLine1 // uiLine1
// //
this.uiLine1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); this.uiLine1.BackColor = System.Drawing.Color.White;
this.uiLine1.FillColor = System.Drawing.Color.White;
this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.uiLine1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.uiLine1.Location = new System.Drawing.Point(4, 97); this.uiLine1.Location = new System.Drawing.Point(4, 85);
this.uiLine1.MinimumSize = new System.Drawing.Size(2, 2); this.uiLine1.MinimumSize = new System.Drawing.Size(2, 2);
this.uiLine1.Name = "uiLine1"; this.uiLine1.Name = "uiLine1";
this.uiLine1.Size = new System.Drawing.Size(182, 2); this.uiLine1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
this.uiLine1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
this.uiLine1.Size = new System.Drawing.Size(182, 28);
this.uiLine1.Style = Sunny.UI.UIStyle.Custom; this.uiLine1.Style = Sunny.UI.UIStyle.Custom;
this.uiLine1.StyleCustomMode = true;
this.uiLine1.TabIndex = 5; this.uiLine1.TabIndex = 5;
this.uiLine1.Text = "用户登录";
this.uiLine1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// edtUser // edtUser
// //
this.edtUser.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtUser.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtUser.EnterAsTab = true; this.edtUser.EnterAsTab = true;
this.edtUser.FillColor = System.Drawing.Color.White;
this.edtUser.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.edtUser.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.edtUser.Location = new System.Drawing.Point(4, 121); this.edtUser.Location = new System.Drawing.Point(4, 121);
this.edtUser.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.edtUser.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtUser.Maximum = 2147483647D;
this.edtUser.Minimum = -2147483648D;
this.edtUser.MinimumSize = new System.Drawing.Size(1, 1); this.edtUser.MinimumSize = new System.Drawing.Size(1, 1);
this.edtUser.Name = "edtUser"; this.edtUser.Name = "edtUser";
this.edtUser.Padding = new System.Windows.Forms.Padding(5); this.edtUser.Padding = new System.Windows.Forms.Padding(5);
this.edtUser.ShowText = false;
this.edtUser.Size = new System.Drawing.Size(182, 29); this.edtUser.Size = new System.Drawing.Size(182, 29);
this.edtUser.Style = Sunny.UI.UIStyle.Custom; this.edtUser.Style = Sunny.UI.UIStyle.Custom;
this.edtUser.Symbol = 61447; this.edtUser.Symbol = 61447;
@ -84,20 +88,19 @@
this.edtUser.TabIndex = 0; this.edtUser.TabIndex = 0;
this.edtUser.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.edtUser.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.edtUser.Watermark = "请输入账号"; this.edtUser.Watermark = "请输入账号";
this.edtUser.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// edtPassword // edtPassword
// //
this.edtPassword.Cursor = System.Windows.Forms.Cursors.IBeam; this.edtPassword.Cursor = System.Windows.Forms.Cursors.IBeam;
this.edtPassword.FillColor = System.Drawing.Color.White;
this.edtPassword.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.edtPassword.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.edtPassword.Location = new System.Drawing.Point(4, 162); this.edtPassword.Location = new System.Drawing.Point(4, 162);
this.edtPassword.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.edtPassword.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.edtPassword.Maximum = 2147483647D;
this.edtPassword.Minimum = -2147483648D;
this.edtPassword.MinimumSize = new System.Drawing.Size(1, 1); this.edtPassword.MinimumSize = new System.Drawing.Size(1, 1);
this.edtPassword.Name = "edtPassword"; this.edtPassword.Name = "edtPassword";
this.edtPassword.Padding = new System.Windows.Forms.Padding(5); this.edtPassword.Padding = new System.Windows.Forms.Padding(5);
this.edtPassword.PasswordChar = '*'; this.edtPassword.PasswordChar = '*';
this.edtPassword.ShowText = false;
this.edtPassword.Size = new System.Drawing.Size(182, 29); this.edtPassword.Size = new System.Drawing.Size(182, 29);
this.edtPassword.Style = Sunny.UI.UIStyle.Custom; this.edtPassword.Style = Sunny.UI.UIStyle.Custom;
this.edtPassword.Symbol = 61475; this.edtPassword.Symbol = 61475;
@ -105,6 +108,7 @@
this.edtPassword.TabIndex = 1; this.edtPassword.TabIndex = 1;
this.edtPassword.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; this.edtPassword.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;
this.edtPassword.Watermark = "请输入密码"; this.edtPassword.Watermark = "请输入密码";
this.edtPassword.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.edtPassword.DoEnter += new System.EventHandler(this.btnLogin_Click); this.edtPassword.DoEnter += new System.EventHandler(this.btnLogin_Click);
// //
// btnLogin // btnLogin
@ -120,24 +124,26 @@
this.btnLogin.Style = Sunny.UI.UIStyle.Custom; this.btnLogin.Style = Sunny.UI.UIStyle.Custom;
this.btnLogin.TabIndex = 2; this.btnLogin.TabIndex = 2;
this.btnLogin.Text = "登录"; this.btnLogin.Text = "登录";
this.btnLogin.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
// //
// btnCancel // btnCancel
// //
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand; this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.btnCancel.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.btnCancel.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128))))); this.btnCancel.FillColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.btnCancel.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.FillHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
this.btnCancel.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnCancel.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.btnCancel.Location = new System.Drawing.Point(100, 206); this.btnCancel.Location = new System.Drawing.Point(100, 206);
this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1); this.btnCancel.MinimumSize = new System.Drawing.Size(1, 1);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0); this.btnCancel.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80))))); this.btnCancel.RectColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
this.btnCancel.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(127)))), ((int)(((byte)(128))))); this.btnCancel.RectHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(115)))), ((int)(((byte)(115)))));
this.btnCancel.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.RectPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnCancel.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(87)))), ((int)(((byte)(89))))); this.btnCancel.RectSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(184)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.btnCancel.ShowFocusColor = true; this.btnCancel.ShowFocusColor = true;
this.btnCancel.Size = new System.Drawing.Size(86, 29); this.btnCancel.Size = new System.Drawing.Size(86, 29);
this.btnCancel.Style = Sunny.UI.UIStyle.Red; this.btnCancel.Style = Sunny.UI.UIStyle.Red;
@ -145,6 +151,7 @@
this.btnCancel.Symbol = 61453; this.btnCancel.Symbol = 61453;
this.btnCancel.TabIndex = 3; this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消"; this.btnCancel.Text = "取消";
this.btnCancel.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// lblTitle // lblTitle
@ -160,6 +167,7 @@
this.lblTitle.TabIndex = 6; this.lblTitle.TabIndex = 6;
this.lblTitle.Text = "SunnyUI.Net"; this.lblTitle.Text = "SunnyUI.Net";
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblTitle.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// lblSubText // lblSubText
// //
@ -172,24 +180,11 @@
this.lblSubText.TabIndex = 7; this.lblSubText.TabIndex = 7;
this.lblSubText.Text = "SunnyUI"; this.lblSubText.Text = "SunnyUI";
this.lblSubText.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.lblSubText.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
// this.lblSubText.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// uiLabel1
//
this.uiLabel1.AutoSize = true;
this.uiLabel1.BackColor = System.Drawing.Color.Transparent;
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.uiLabel1.Location = new System.Drawing.Point(58, 85);
this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(74, 21);
this.uiLabel1.Style = Sunny.UI.UIStyle.Custom;
this.uiLabel1.TabIndex = 8;
this.uiLabel1.Text = "用户登录";
this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// uiPanel1 // uiPanel1
// //
this.uiPanel1.Controls.Add(this.uiAvatar1); this.uiPanel1.Controls.Add(this.uiAvatar1);
this.uiPanel1.Controls.Add(this.uiLabel1);
this.uiPanel1.Controls.Add(this.uiLine1); this.uiPanel1.Controls.Add(this.uiLine1);
this.uiPanel1.Controls.Add(this.edtUser); this.uiPanel1.Controls.Add(this.edtUser);
this.uiPanel1.Controls.Add(this.edtPassword); this.uiPanel1.Controls.Add(this.edtPassword);
@ -209,6 +204,7 @@
this.uiPanel1.TabIndex = 9; this.uiPanel1.TabIndex = 9;
this.uiPanel1.Text = null; this.uiPanel1.Text = null;
this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter; this.uiPanel1.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this.uiPanel1.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
// //
// UILoginForm // UILoginForm
// //
@ -227,8 +223,8 @@
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.ShowTitle = false; this.ShowTitle = false;
this.Text = "UILogin"; this.Text = "UILogin";
this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 750, 450);
this.uiPanel1.ResumeLayout(false); this.uiPanel1.ResumeLayout(false);
this.uiPanel1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -242,7 +238,6 @@
protected UILabel lblTitle; protected UILabel lblTitle;
private UISymbolButton btnLogin; private UISymbolButton btnLogin;
private UISymbolButton btnCancel; private UISymbolButton btnCancel;
private UILabel uiLabel1;
protected UIPanel uiPanel1; protected UIPanel uiPanel1;
protected UILabel lblSubText; protected UILabel lblSubText;
} }

View File

@ -15,7 +15,7 @@ namespace Sunny.UI
} }
[Description("顶部标题"), Category("SunnyUI")] [Description("顶部标题"), Category("SunnyUI")]
[DefaultValue(null)] [DefaultValue("SunnyUI.Net")]
public string Title public string Title
{ {
get => lblTitle.Text; get => lblTitle.Text;
@ -23,13 +23,21 @@ namespace Sunny.UI
} }
[Description("底部说明"), Category("SunnyUI")] [Description("底部说明"), Category("SunnyUI")]
[DefaultValue(null)] [DefaultValue("SunnyUI")]
public string SubText public string SubText
{ {
get => lblSubText.Text; get => lblSubText.Text;
set => lblSubText.Text = value; set => lblSubText.Text = value;
} }
[Description("用户登录"), Category("SunnyUI")]
[DefaultValue("用户登录")]
public string LoginText
{
get => uiLine1.Text;
set => uiLine1.Text = value;
}
private UILoginImage loginImage; private UILoginImage loginImage;
[DefaultValue(UILoginImage.Login1)] [DefaultValue(UILoginImage.Login1)]
@ -113,5 +121,37 @@ namespace Sunny.UI
get => edtPassword.Text; get => edtPassword.Text;
set => edtPassword.Text = value; set => edtPassword.Text = value;
} }
[DefaultValue("请输入账号")]
[Description("账号水印文字"), Category("SunnyUI")]
public string UserNameWatermark
{
get => edtUser.Watermark;
set => edtUser.Watermark = value;
}
[DefaultValue(null)]
[Description("请输入密码"), Category("SunnyUI")]
public string PasswordWatermark
{
get => edtPassword.Watermark;
set => edtPassword.Watermark = value;
}
[DefaultValue(null)]
[Description("登录"), Category("SunnyUI")]
public string ButtonLoginText
{
get => btnLogin.Text;
set => btnLogin.Text = value;
}
[DefaultValue(null)]
[Description("取消"), Category("SunnyUI")]
public string ButtonCancelText
{
get => btnCancel.Text;
set => btnCancel.Text = value;
}
} }
} }