mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:59:20 +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 SuppressMove: boolean);
|
||||||
var
|
var
|
||||||
ColCount: Integer;
|
ColCount: Integer;
|
||||||
|
DW: Integer;
|
||||||
|
ARect: TRect;
|
||||||
begin
|
begin
|
||||||
ColCount := TCustomListBox(AWinControl).Columns;
|
ColCount := TCustomListBox(AWinControl).Columns;
|
||||||
if ColCount > 1 then
|
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;
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.CreateHandle(const AWinControl: TWinControl;
|
class function TWin32WSCustomListBox.CreateHandle(const AWinControl: TWinControl;
|
||||||
|
Loading…
Reference in New Issue
Block a user