I need to add just 2px :) to a height of a row in a list view (a custom drawn progress bar is too narrow now).
There are two good answers Change Listview item height, http://www.delphipages.com/forum/showthread.php?t=49939, but I couldn't do it.
I know that it is possible to do with an image list, but I have already 16x16 images :)
Can anybody help me? I'll appreciate it.
Respond to the CN_MEASUREITEM
control notification message, as follows:
type
TListView = class(ComCtrls.TListView)
private
procedure CNMeasureItem(var Message: TWMMeasureItem); message CN_MEASUREITEM;
end;
TForm1 = class(TForm)
...
procedure TListView.CNMeasureItem(var Message: TWMMeasureItem);
begin
inherited;
Inc(Message.MeasureItemStruct.itemHeight, 2);
end;
Note: this message will only be send if the OwnerDraw
property is true.
A quick and dirty alternative without writing any code would be to add a TImageList, set its width to 1 and its height to whatever you want the lines height to be and assign it to the SmallImages of the listview.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With