View Issue Details

IDProjectCategoryView StatusLast Update
0026036LazarusLCLpublic2014-04-17 13:51
Reporterwp Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86, x64OSWindows 
Product Version1.3 (SVN) 
Summary0026036: Checkmark in TCheckListBox pixelated at 120 ppi
DescriptionThe checkboxes embedded into a TCheckListbox are drawn too large compared to a standalone TCheckbox if the program runs at 120 dpi (screen resolution 125% in Windows 7). What is even more disturbing is that the checkmarks of the listbox are pixelated at this resolution giving the application a non-professional appearance.

The bug is in Win32WSCheckLst.pp, procedure TWin32WSCustomCheckListBox.DefaultWndHandler, where the rectangle for the checkbox is calculated form the size of the listbox item, not from the size defined by the theme.

The attached patch fixes the issue.
Steps To Reproduce- Set your system (Windows!) to 125 dpi.
- Create a new form
- Add a TChecklistbox and a TCheckbox for comparison --> the checkboxes in the listbox are larger than the standalone checkbox
- Add text to the listbox
- Or: load attached demo
- Run the program and check an item in the listbox
--> the checkmark in the listbox is pixelated

Apply attached patch and repeat
--> no more issues.
TagsNo tags attached.
Fixed in Revision44751
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

wp

2014-04-17 09:56

developer  

checklistbox.patch (871 bytes)   
Index: win32/win32wschecklst.pp
===================================================================
--- win32/win32wschecklst.pp	(revision 44735)
+++ win32/win32wschecklst.pp	(working copy)
@@ -183,6 +183,7 @@
     TextFlags: DWord;
     OldColor: COLORREF;
     OldBkMode: Integer;
+    sz: TSize;
   {$ifdef WindowsUnicodeSupport}
     AnsiBuffer: string;
     WideBuffer: widestring;
@@ -214,6 +215,10 @@
       ARect.Right := ARect.Left + ARect.Bottom - ARect.Top;
 
     Details := ThemeServices.GetElementDetails(ThemeStateMap[CheckListBox.State[Data^.ItemID], Enabled]);
+    sz := ThemeServices.GetDetailSize(Details);
+    ARect := Bounds((ARect.Left + ARect.Right - sz.cx) div 2, (ARect.Top + ARect.Bottom - sz.cy) div 2,
+      sz.cx, sz.cy);
+    InflateRect(ARect, 1, 1);
     ThemeServices.DrawElement(Data^._HDC, Details, ARect);
 
     // draw text
checklistbox.patch (871 bytes)   

wp

2014-04-17 09:56

developer  

original.png (26,776 bytes)   
original.png (26,776 bytes)   

wp

2014-04-17 09:57

developer  

patched.png (26,637 bytes)   
patched.png (26,637 bytes)   

wp

2014-04-17 09:57

developer  

Zeljan Rikalo

2014-04-17 11:36

developer   ~0074438

Please test and close if ok.

wp

2014-04-17 13:51

developer   ~0074441

Wow - that was fast!

Issue History

Date Modified Username Field Change
2014-04-17 09:56 wp New Issue
2014-04-17 09:56 wp File Added: checklistbox.patch
2014-04-17 09:56 wp File Added: original.png
2014-04-17 09:57 wp File Added: patched.png
2014-04-17 09:57 wp File Added: CheckListBox-pixelatedCheckmark.zip
2014-04-17 11:36 Zeljan Rikalo Fixed in Revision => 44751
2014-04-17 11:36 Zeljan Rikalo LazTarget => -
2014-04-17 11:36 Zeljan Rikalo Note Added: 0074438
2014-04-17 11:36 Zeljan Rikalo Status new => resolved
2014-04-17 11:36 Zeljan Rikalo Resolution open => fixed
2014-04-17 11:36 Zeljan Rikalo Assigned To => Zeljan Rikalo
2014-04-17 13:51 wp Note Added: 0074441
2014-04-17 13:51 wp Status resolved => closed