* UITabControlMenu: 重写ItemSize,将宽、高调整为正常显示
This commit is contained in:
parent
0c9c9ef9af
commit
e916d6911d
@ -17,6 +17,7 @@
|
|||||||
* 创建日期: 2020-01-01
|
* 创建日期: 2020-01-01
|
||||||
*
|
*
|
||||||
* 2020-01-01: V2.2.0 增加文件说明
|
* 2020-01-01: V2.2.0 增加文件说明
|
||||||
|
* 2022-08-11: V3.0.2 重写ItemSize,将宽、高调整为正常显示
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -38,7 +39,7 @@ namespace Sunny.UI
|
|||||||
DoubleBuffered = true;
|
DoubleBuffered = true;
|
||||||
UpdateStyles();
|
UpdateStyles();
|
||||||
|
|
||||||
ItemSize = new Size(40, 200);
|
base.ItemSize = new Size(40, 200);
|
||||||
DrawMode = TabDrawMode.OwnerDrawFixed;
|
DrawMode = TabDrawMode.OwnerDrawFixed;
|
||||||
Font = UIFontColor.Font();
|
Font = UIFontColor.Font();
|
||||||
AfterSetFillColor(FillColor);
|
AfterSetFillColor(FillColor);
|
||||||
@ -50,6 +51,17 @@ namespace Sunny.UI
|
|||||||
_fillColor = UIStyles.Blue.TabControlBackColor;
|
_fillColor = UIStyles.Blue.TabControlBackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(typeof(Size), "200, 40")]
|
||||||
|
public new Size ItemSize
|
||||||
|
{
|
||||||
|
get => new Size(base.ItemSize.Height, base.ItemSize.Width);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.ItemSize = new Size(value.Height, value.Width);
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 禁止控件跟随窗体缩放
|
/// 禁止控件跟随窗体缩放
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -346,7 +358,7 @@ namespace Sunny.UI
|
|||||||
e.Graphics.Clear(TabBackColor);
|
e.Graphics.Clear(TabBackColor);
|
||||||
for (int index = 0; index <= TabCount - 1; index++)
|
for (int index = 0; index <= TabCount - 1; index++)
|
||||||
{
|
{
|
||||||
Rectangle TabRect = new Rectangle(GetTabRect(index).Location.X - 2, GetTabRect(index).Location.Y - 2, ItemSize.Height + 4, ItemSize.Width);
|
Rectangle TabRect = new Rectangle(GetTabRect(index).Location.X - 2, GetTabRect(index).Location.Y - 2, base.ItemSize.Height + 4, base.ItemSize.Width);
|
||||||
SizeF sf = e.Graphics.MeasureString(TabPages[index].Text, Font);
|
SizeF sf = e.Graphics.MeasureString(TabPages[index].Text, Font);
|
||||||
int textLeft = 4 + 6 + 4 + (ImageList?.ImageSize.Width ?? 0);
|
int textLeft = 4 + 6 + 4 + (ImageList?.ImageSize.Width ?? 0);
|
||||||
if (TextAlignment == HorizontalAlignment.Right)
|
if (TextAlignment == HorizontalAlignment.Right)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user