1
0
Эх сурвалжийг харах

Scaling combo box drop down menu

(cherry picked from commit 7b6636360badd549392e792fc427ad7238128b60)

Source commit: 05ad668ce79ffcc3bae7a8e0699e13878a63f33c
Martin Prikryl 9 жил өмнө
parent
commit
a20fce0b2d

+ 3 - 3
source/packages/filemng/IEComboBox.pas

@@ -160,7 +160,7 @@ procedure Register;
 implementation
 
 uses
-  SysUtils, Forms, Dialogs, Imglist, ShellAPI, CommCtrl, Math, Windows;
+  SysUtils, Forms, Dialogs, Imglist, ShellAPI, CommCtrl, Math, Windows, PasTools;
 
 procedure Register;
 begin
@@ -213,9 +213,9 @@ begin
       Self.Perform(CB_SETDROPPEDWIDTH, FDropDownFixedWidth, 0)
     else
   begin
-    ItemWidth := GetMaxItemWidth + 8;
+    ItemWidth := GetMaxItemWidth + ScaleByPixelsPerInch(8);
     if Items.Count > DropDowncount then
-      Inc(ItemWidth, 16);
+      Inc(ItemWidth, GetSystemMetrics(SM_CXVSCROLL));
     Self.Perform(CB_SETDROPPEDWIDTH, ItemWidth, 0);
   end;
 

+ 5 - 2
source/packages/my/HistoryComboBox.pas

@@ -54,6 +54,9 @@ procedure Register;
 
 implementation
 
+uses
+  PasTools;
+
 procedure Register;
 begin
   RegisterComponents('Martin', [THistoryComboBox]);
@@ -110,9 +113,9 @@ begin
   if soDropDown in SaveOn then SaveToHistory;
 
   // taken from TIECustomComboBox:
-  ItemWidth := GetMaxItemWidth + 8;
+  ItemWidth := GetMaxItemWidth + ScaleByPixelsPerInch(8);
   if Items.Count > DropDowncount then
-    Inc(ItemWidth, 16);
+    Inc(ItemWidth, GetSystemMetrics(SM_CXVSCROLL));
   Self.Perform(CB_SETDROPPEDWIDTH, ItemWidth, 0);
 end;