* 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> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout(); SuspendLayout();
// //
// UITitlePanel // UITitlePanel
// //
this.Name = "UITitlePanel"; Name = "UITitlePanel";
this.Padding = new System.Windows.Forms.Padding(0, 35, 0, 0); VisibleChanged += UITitlePanel_VisibleChanged;
this.ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion

View File

@ -25,6 +25,7 @@
* 2023-05-02: V3.3.6 * 2023-05-02: V3.3.6
* 2023-05-12: V3.3.6 TextAlign改为TextAlignment * 2023-05-12: V3.3.6 TextAlign改为TextAlignment
* 2023-05-12: V3.3.6 DrawString函数 * 2023-05-12: V3.3.6 DrawString函数
* 2023-07-12: V3.4.0 Padding设置
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -50,32 +51,12 @@ namespace Sunny.UI
if (_titleHeight != value) if (_titleHeight != value)
{ {
_titleHeight = Math.Max(19, value); _titleHeight = Math.Max(19, value);
Padding = new Padding(Padding.Left, Math.Max(value, Padding.Top), Padding.Right, Padding.Bottom);
CalcSystemBoxPos(); CalcSystemBoxPos();
Invalidate(); 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() public UITitlePanel()
{ {
InitializeComponent(); InitializeComponent();
@ -390,5 +371,16 @@ namespace Sunny.UI
base.OnMouseDoubleClick(e); 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

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, 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="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"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->