浏览代码

Bug 2090: Extension options dialog layout broken on systems with multiple monitor with different text scaling

https://winscp.net/tracker/2090
(cherry picked from commit b7d4541816b2f627a80f98ec5dd112ce5b1c32f5)

Source commit: a291c59bcfeb41212014dfe0aaec4b72ac3bf53a
Martin Prikryl 3 年之前
父节点
当前提交
007aed9e0f
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      source/forms/Custom.cpp

+ 11 - 2
source/forms/Custom.cpp

@@ -317,6 +317,7 @@ void __fastcall TCustomDialog::AddText(TLabel * Label)
 {
   Label->Parent = GetDefaultParent();
 
+  DebugAssert(Label->AutoSize);
   Label->WordWrap = true;
   Label->Left = FIndent;
   Label->Width = GetMaxControlWidth(Label);
@@ -328,7 +329,15 @@ void __fastcall TCustomDialog::AddText(TLabel * Label)
   DrawText(Label->Canvas->Handle, Label->Caption.c_str(), Label->Caption.Length() + 1, &TextRect,
     DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK | DT_NOPREFIX |
     Label->DrawTextBiDiModeFlagsReadingOnly());
-  Label->Height = TextRect.Height();
+  if (TextRect.Height() > Label->Height)
+  {
+    Label->Height = TextRect.Height();
+    Label->AutoSize = false;
+  }
+  else
+  {
+    Label->WordWrap = false;
+  }
 
   AdjustHeight(Label);
 }
@@ -337,8 +346,8 @@ void __fastcall TCustomDialog::AddText(TStaticText * Label)
 {
   Label->Parent = GetDefaultParent();
 
+  DebugAssert(Label->AutoSize);
   Label->Left = FIndent;
-  Label->Width = GetMaxControlWidth(Label);
   Label->Top = FPos;
   Label->ShowAccelChar = false;