* UITitlePanel: 删除Padding设置

This commit is contained in:
Sunny 2023-07-12 10:42:50 +08:00
parent 2798c6d59a
commit 4b0ca7dca6
3 changed files with 42 additions and 51 deletions

View File

@ -28,14 +28,13 @@
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
SuspendLayout();
//
// UITitlePanel
//
this.Name = "UITitlePanel";
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0);
this.ResumeLayout(false);
Name = "UITitlePanel";
VisibleChanged += UITitlePanel_VisibleChanged;
ResumeLayout(false);
}
#endregion

View File

@ -25,6 +25,7 @@
* 2023-05-02: V3.3.6
* 2023-05-12: V3.3.6 TextAlign改为TextAlignment
* 2023-05-12: V3.3.6 DrawString函数
* 2023-07-12: V3.4.0 Padding设置
******************************************************************************/
using System;
@ -50,32 +51,12 @@ namespace Sunny.UI
if (_titleHeight != value)
{
_titleHeight = Math.Max(19, value);
Padding = new Padding(Padding.Left, Math.Max(value, Padding.Top), Padding.Right, Padding.Bottom);
CalcSystemBoxPos();
Invalidate();
}
}
}
protected override void OnPaddingChanged(EventArgs e)
{
base.OnPaddingChanged(e);
if (Padding.Top != Math.Max(TitleHeight, Padding.Top))
{
Padding = new Padding(Padding.Left, Math.Max(TitleHeight, Padding.Top), Padding.Right, Padding.Bottom);
}
}
protected override void OnControlAdded(ControlEventArgs e)
{
base.OnControlAdded(e);
if (e.Control.Top < TitleHeight)
{
e.Control.Top = TitleHeight + 1;
}
}
public UITitlePanel()
{
InitializeComponent();
@ -390,5 +371,16 @@ namespace Sunny.UI
base.OnMouseDoubleClick(e);
}
private void UITitlePanel_VisibleChanged(object sender, EventArgs e)
{
foreach (Control control in Controls)
{
if (control.Top < TitleHeight)
{
control.Top = TitleHeight + 1;
}
}
}
}
}

View File

@ -18,7 +18,7 @@
<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="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>