mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 11:19:26 +02:00
win32: improve column with calculation in multi column listbox
git-svn-id: trunk@16800 -
This commit is contained in:
parent
11fd229957
commit
f5c5b2ab66
@ -545,10 +545,20 @@ class procedure TWin32WSCustomListBox.AdaptBounds(
|
||||
var SuppressMove: boolean);
|
||||
var
|
||||
ColCount: Integer;
|
||||
DW: Integer;
|
||||
ARect: TRect;
|
||||
begin
|
||||
ColCount := TCustomListBox(AWinControl).Columns;
|
||||
if ColCount > 1 then
|
||||
SendMessage(AWinControl.Handle, LB_SETCOLUMNWIDTH, Max(1, Width div ColCount), 0);
|
||||
begin
|
||||
// Listbox has a border and Width argument is a window rect =>
|
||||
// Decrease it by border width
|
||||
Windows.GetClientRect(AWinControl.Handle, ARect);
|
||||
DW := ARect.Right - ARect.Left;
|
||||
Windows.GetWindowRect(AWinControl.Handle, ARect);
|
||||
DW := ARect.Right - ARect.Left - DW;
|
||||
SendMessage(AWinControl.Handle, LB_SETCOLUMNWIDTH, Max(1, (Width - DW) div ColCount), 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListBox.CreateHandle(const AWinControl: TWinControl;
|
||||
|
Loading…
Reference in New Issue
Block a user