Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to place TCheckBox in Column of TListView? or similar way? 1

Status
Not open for further replies.

smilife

Programmer
Dec 1, 2003
30
CN
how to place TCheckBox in TListView?
In a ListView of vsReport, I want a column implemented by
TCheckBox? Is it possible?
If not, which other is good way to implement this?
 
I got this working...
Make the Listview Ownerdrawn, and put this (and more ;) in
CustomDrawItem:

Hope this helps

-fruNNik



procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
r: TRect;
flags: Word;
begin
r := Item.DisplayRect(drBounds);
r.Right := 13;

// make even items checked
flags := DFCS_BUTTONCHECK;
if Item.Index mod 2 = 0 then
flags := f or DFCS_CHECKED;

DrawFrameControl(
ListView1.Canvas.Handle,
r,
DFC_BUTTON,
f
);
end;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top