开发者

How to increase row height of listview in report style?

开发者 https://www.devze.com 2023-03-28 15:25 出处:网络
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).

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 tha开发者_如何学Ct 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消