* UIForm:修正控件位置在标题栏下方

This commit is contained in:
Sunny 2020-07-02 20:31:20 +08:00
parent d0143bc63c
commit 0d19046f76
5 changed files with 14 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -45,8 +45,6 @@ namespace Sunny.UI
{ {
InitializeComponent(); InitializeComponent();
base.BackColor = UIColor.LightBlue;
if (this.Register()) if (this.Register())
{ {
SetStyle(UIStyles.Style); SetStyle(UIStyles.Style);
@ -55,13 +53,7 @@ namespace Sunny.UI
SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.DoubleBuffer, true);
base.DoubleBuffered = true;
Padding = new Padding(0, titleHeight, 0, 0);
UpdateStyles(); UpdateStyles();
base.Font = UIFontColor.Font;
FormBorderStyle = FormBorderStyle.None;
StartPosition = FormStartPosition.CenterScreen;
Version = UIGlobal.Version; Version = UIGlobal.Version;
} }
@ -147,10 +139,10 @@ namespace Sunny.UI
} }
} }
// if (ShowTitle && e.Control.Top < TitleHeight) if (e.Control.Top < TitleHeight)
// { {
// e.Control.Top = TitleHeight; e.Control.Top = Padding.Top;
// } }
} }
[DefaultValue(null)] [DefaultValue(null)]
@ -283,9 +275,10 @@ namespace Sunny.UI
get => titleHeight; get => titleHeight;
set set
{ {
titleHeight = Math.Max(value, 0); titleHeight = Math.Max(value, 31);
CalcSystemBoxPos(); Padding = new Padding(0, showTitle ? titleHeight : 0, 0, 0);
Invalidate(); Invalidate();
CalcSystemBoxPos();
} }
} }
@ -850,7 +843,7 @@ namespace Sunny.UI
e.Graphics.DrawLine(Color.White, e.Graphics.DrawLine(Color.White,
MaximizeBoxRect.Left + MaximizeBoxRect.Width / 2 - 2, MaximizeBoxRect.Left + MaximizeBoxRect.Width / 2 - 2,
MaximizeBoxRect.Top + MaximizeBoxRect.Height / 2 - 4, MaximizeBoxRect.Top + MaximizeBoxRect.Height / 2 - 4,
MaximizeBoxRect.Left + MaximizeBoxRect.Width / 2 +5, MaximizeBoxRect.Left + MaximizeBoxRect.Width / 2 + 5,
MaximizeBoxRect.Top + MaximizeBoxRect.Height / 2 - 4); MaximizeBoxRect.Top + MaximizeBoxRect.Height / 2 - 4);
e.Graphics.DrawLine(Color.White, e.Graphics.DrawLine(Color.White,

View File

@ -35,8 +35,14 @@
// UIForm // UIForm
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.ClientSize = new System.Drawing.Size(800, 480); this.ClientSize = new System.Drawing.Size(800, 480);
this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "UIForm"; this.Name = "UIForm";
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "UIForm"; this.Text = "UIForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIForm_FormClosing);
this.ResumeLayout(false); this.ResumeLayout(false);