From f51e3d26b37ceda2d5e7aa12e1b08dfaf7b3b634 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 13 Jul 2016 22:07:36 +0000 Subject: [PATCH] tvplanit: Again - fix height of category combobox in event editor at 120 dpi. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4945 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpevnteditdlg.lfm | 4 +--- components/tvplanit/source/vpevnteditdlg.pas | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/tvplanit/source/vpevnteditdlg.lfm b/components/tvplanit/source/vpevnteditdlg.lfm index 94acb14e3..a7a6c76f1 100644 --- a/components/tvplanit/source/vpevnteditdlg.lfm +++ b/components/tvplanit/source/vpevnteditdlg.lfm @@ -286,13 +286,11 @@ object DlgEventEdit: TDlgEventEdit end object Category: TComboBox Left = 484 - Height = 21 + Height = 23 Top = 40 Width = 180 ItemHeight = 15 OnDrawItem = CategoryDrawItem - ReadOnly = True - Style = csOwnerDrawFixed TabOrder = 2 end object RecurringType: TComboBox diff --git a/components/tvplanit/source/vpevnteditdlg.pas b/components/tvplanit/source/vpevnteditdlg.pas index fe57a67e0..c2b84f627 100644 --- a/components/tvplanit/source/vpevnteditdlg.pas +++ b/components/tvplanit/source/vpevnteditdlg.pas @@ -199,6 +199,8 @@ end; { TDlgEventEdit } procedure TDlgEventEdit.FormCreate(Sender: TObject); +var + h: Integer; begin {$IFDEF LCL} StartTime := TTimeEdit.Create(self); @@ -246,7 +248,13 @@ begin end; IntervalUpDown.Associate := FCustomInterval; - Category.ItemHeight := LocationEdit.Height - 6; + // This is needed as workaround for the combobox height at higher dpi. + // We design it with Style csDropdown where the height is correct, and then + // use the corresponding, correct ItemHeight after switching to csOwnerDrawFixed + // (which is needed to draw the color boxes). + h := Category.ItemHeight; + Category.Style := csOwnerDrawFixed; + Category.ItemHeight := h; end; {=====}