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

View File

@ -35,8 +35,14 @@
// UIForm
//
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.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.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "UIForm";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.UIForm_FormClosing);
this.ResumeLayout(false);