Commit 40b58740 王海洋

更改文本居中

1 个父辈 9755a537
...@@ -112,7 +112,7 @@ namespace Asa.FaceControl ...@@ -112,7 +112,7 @@ namespace Asa.FaceControl
using Graphics g = CreateGraphics(); using Graphics g = CreateGraphics();
SizeF sf = g.MeasureString(Text, _titleFont); SizeF sf = g.MeasureString(Text, _titleFont);
x = (Width - sf.Width) / 2f; x = (Width - sf.Width) / 2f;
y = (_titleHeight - sf.Height) / 2f; y = (_titleHeight - sf.Height) / 2f+6f;
titleTextRect = new RectangleF(x, y, sf.Width, sf.Height); titleTextRect = new RectangleF(x, y, sf.Width, sf.Height);
//图标位置 //图标位置
...@@ -258,10 +258,17 @@ namespace Asa.FaceControl ...@@ -258,10 +258,17 @@ namespace Asa.FaceControl
{ {
if (_iconBmp != null) if (_iconBmp != null)
g.DrawImage(formActivated ? _iconBmp : iconGrayBmp, iconRect, new RectangleF(0, 0, _iconBmp.Width, _iconBmp.Height), GraphicsUnit.Pixel); g.DrawImage(formActivated ? _iconBmp : iconGrayBmp, iconRect, new RectangleF(0, 0, _iconBmp.Width, _iconBmp.Height), GraphicsUnit.Pixel);
// 创建调整后的矩形 - 向下移动 6 像素
RectangleF adjustedRect = new RectangleF(
titleTextRect.X,
titleTextRect.Y + 3f, // 增加这个值使文字下移更多
titleTextRect.Width,
titleTextRect.Height
);
if (formActivated) if (formActivated)
g.DrawString(Text, _titleFont, BRUSH_TEXT, titleTextRect); g.DrawString(Text, _titleFont, BRUSH_TEXT, adjustedRect);
else else
g.DrawString(Text, _titleFont, BRUSH_TEXT_DISABLED, titleTextRect); g.DrawString(Text, _titleFont, BRUSH_TEXT_DISABLED, adjustedRect);
} }
private void ChangeMouseCursor(Point pt) private void ChangeMouseCursor(Point pt)
......
...@@ -44,7 +44,7 @@ namespace Asa.FaceControl ...@@ -44,7 +44,7 @@ namespace Asa.FaceControl
if (ctlMin != null) if (ctlMin != null)
{ {
ctlMin.Size = new Size(46, 32); ctlMin.Size = new Size(46, 28);
n += ctlMin.Width; n += ctlMin.Width;
ctlMin.Location = new Point(Width - BorderWidth - n, BorderWidth + 1); ctlMin.Location = new Point(Width - BorderWidth - n, BorderWidth + 1);
ctlMin.Anchor = AnchorStyles.Top | AnchorStyles.Right; ctlMin.Anchor = AnchorStyles.Top | AnchorStyles.Right;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!