瀏覽代碼

Improving scaling of thirdparty "browser" control

With Tahoma font it does not work nicely. But the news browser control on Update box works well. It turned out to be due to Segoe UI font.
While it can just be coincidence, we want to move to Segoe UI anyway. So let's do it for About dialog already now.

Source commit: 3e6f173cb37d2e594de5d3bb2fdc2b6eec0e08d5
Martin Prikryl 11 月之前
父節點
當前提交
b75c57e786
共有 3 個文件被更改,包括 43 次插入47 次删除
  1. 1 5
      source/forms/About.cpp
  2. 41 41
      source/forms/About.dfm
  3. 1 1
      source/windows/VCLCommon.cpp

+ 1 - 5
source/forms/About.cpp

@@ -293,11 +293,7 @@ void __fastcall TAboutDialog::DoLoadThirdParty()
     LoadStr(ABOUT_PNG_COPYRIGHT) + Br +
     CreateLink(LoadStr(ABOUT_PNG_URL)));
 
-  std::unique_ptr<TFont> DefaultFont(new TFont());
-  DefaultFont->Assign(Application->DefaultFont);
-  DefaultFont->Height = ScaleByPixelsPerInchFromSystem(DefaultFont->Height, this);
-
-  ThirdParty = GenerateAppHtmlPage(DefaultFont.get(), ThirdPartyPanel, ThirdParty, false);
+  ThirdParty = GenerateAppHtmlPage(Font, ThirdPartyPanel, ThirdParty, false);
 
   LoadBrowserDocument(FThirdPartyWebBrowser, ThirdParty);
 }

+ 41 - 41
source/forms/About.dfm

@@ -6,25 +6,25 @@ object AboutDialog: TAboutDialog
   BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
   BorderStyle = bsDialog
   Caption = 'About application'
-  ClientHeight = 501
-  ClientWidth = 410
+  ClientHeight = 526
+  ClientWidth = 444
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
   Font.Color = clWindowText
-  Font.Height = -11
-  Font.Name = 'Tahoma'
+  Font.Height = -12
+  Font.Name = 'Segoe UI'
   Font.Style = []
   KeyPreview = True
   Position = poOwnerFormCenter
   OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged
   OnKeyDown = FormKeyDown
   DesignSize = (
-    410
-    501)
-  TextHeight = 13
+    444
+    526)
+  TextHeight = 15
   object OKButton: TButton
-    Left = 243
-    Top = 468
+    Left = 277
+    Top = 493
     Width = 75
     Height = 25
     Anchors = [akRight, akBottom]
@@ -37,7 +37,7 @@ object AboutDialog: TAboutDialog
   end
   object LicenseButton: TButton
     Left = 62
-    Top = 468
+    Top = 493
     Width = 75
     Height = 25
     Anchors = [akLeft, akBottom]
@@ -46,8 +46,8 @@ object AboutDialog: TAboutDialog
     OnClick = LicenseButtonClick
   end
   object HelpButton: TButton
-    Left = 325
-    Top = 468
+    Left = 359
+    Top = 493
     Width = 75
     Height = 25
     Anchors = [akRight, akBottom]
@@ -58,61 +58,61 @@ object AboutDialog: TAboutDialog
   object Panel: TPanel
     Left = 0
     Top = 0
-    Width = 410
-    Height = 460
+    Width = 444
+    Height = 485
     Anchors = [akLeft, akTop, akRight, akBottom]
     BevelOuter = bvNone
     Color = clWindow
     ParentBackground = False
     TabOrder = 3
     DesignSize = (
-      410
-      460)
+      444
+      485)
     object ApplicationLabel: TLabel
       Left = 62
       Top = 12
-      Width = 52
-      Height = 13
+      Width = 61
+      Height = 15
       Caption = 'Application'
       ShowAccelChar = False
     end
     object VersionLabel: TLabel
       Left = 62
       Top = 28
-      Width = 127
-      Height = 13
+      Width = 135
+      Height = 15
       Caption = 'Version 2.0.0 (Build 12) XX'
       ShowAccelChar = False
     end
     object WinSCPCopyrightLabel: TLabel
       Left = 62
       Top = 56
-      Width = 180
-      Height = 13
+      Width = 197
+      Height = 15
       Caption = 'Copyright '#169' 2000-2003 Martin Prikryl'
       ShowAccelChar = False
     end
     object ProductSpecificMessageLabel: TLabel
       Left = 62
       Top = 100
-      Width = 277
-      Height = 13
+      Width = 304
+      Height = 15
       Caption = 'To send comments and report bugs use support forum at:'
       ShowAccelChar = False
     end
     object Label3: TLabel
       Left = 62
       Top = 259
-      Width = 91
-      Height = 13
+      Width = 101
+      Height = 15
       Caption = 'Portions copyright:'
       ShowAccelChar = False
     end
     object RegistrationLabel: TLabel
       Left = 62
       Top = 144
-      Width = 127
-      Height = 13
+      Width = 140
+      Height = 15
       Caption = 'This product is licensed to:'
       ShowAccelChar = False
     end
@@ -126,8 +126,8 @@ object AboutDialog: TAboutDialog
     object HomepageLabel: TStaticText
       Left = 62
       Top = 72
-      Width = 128
-      Height = 17
+      Width = 143
+      Height = 19
       Caption = 'http://XXXXXXwinscp.net/'
       TabOrder = 0
       TabStop = True
@@ -135,8 +135,8 @@ object AboutDialog: TAboutDialog
     object ForumUrlLabel: TStaticText
       Left = 62
       Top = 116
-      Width = 148
-      Height = 17
+      Width = 167
+      Height = 19
       Caption = 'http://XXXXwinscp.net/forum/'
       TabOrder = 1
       TabStop = True
@@ -144,8 +144,8 @@ object AboutDialog: TAboutDialog
     object ThirdPartyPanel: TPanel
       Left = 62
       Top = 277
-      Width = 338
-      Height = 168
+      Width = 372
+      Height = 193
       Anchors = [akLeft, akTop, akRight]
       BevelKind = bkTile
       BevelOuter = bvNone
@@ -155,7 +155,7 @@ object AboutDialog: TAboutDialog
     object RegistrationBox: TPanel
       Left = 62
       Top = 162
-      Width = 338
+      Width = 372
       Height = 89
       Anchors = [akLeft, akTop, akRight]
       BevelKind = bkTile
@@ -164,12 +164,12 @@ object AboutDialog: TAboutDialog
       ParentColor = True
       TabOrder = 3
       DesignSize = (
-        334
+        368
         85)
       object RegistrationSubjectLabel: TLabel
         Left = 8
         Top = 8
-        Width = 241
+        Width = 275
         Height = 65
         Anchors = [akLeft, akTop, akRight]
         AutoSize = False
@@ -180,16 +180,16 @@ object AboutDialog: TAboutDialog
       object RegistrationLicensesLabel: TLabel
         Left = 8
         Top = 43
-        Width = 106
-        Height = 13
+        Width = 118
+        Height = 15
         Caption = 'Number of Licenses: X'
         ShowAccelChar = False
       end
       object RegistrationProductIdLabel: TStaticText
         Left = 8
         Top = 65
-        Width = 148
-        Height = 17
+        Width = 154
+        Height = 19
         Caption = 'Product ID: xxxx-xxxx-xxxxx'
         ShowAccelChar = False
         TabOrder = 0

+ 1 - 1
source/windows/VCLCommon.cpp

@@ -1044,7 +1044,7 @@ void __fastcall UseSystemSettingsPre(TForm * Control)
 
   // We have legacy XE6 font (Tahoma) explicitly set in DFMs to match the layout.
   // That unlinks the font fonts from the Application->DefaultFont. We set the DefaultFont to Tahoma in WinSCP.cpp.
-  DebugAssert(SameFont(Control->Font, Application->DefaultFont));
+  DebugAssert((Control->Name == L"AboutDialog") || SameFont(Control->Font, Application->DefaultFont));
 
   ApplySystemSettingsOnControl(Control);
 };