Browse Source

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

https://winscp.net/tracker/2090

Source commit: c135da5c17da8c8efd6e6a6031a4339be608bd0c
Martin Prikryl 3 years ago
parent
commit
b7d4541816
1 changed files with 11 additions and 2 deletions
  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;