unit FMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ExtCtrls, Collect, StdCtrls;
type
TfmMain =
class(TForm)
lvData: TListView;
imOK: TImage;
imNOK: TImage;
nbBrowse: TButton;
procedure FormCreate(Sender: TObject);
procedure lvDataAdvancedCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fmMain: TfmMain;
(* ========================================================================== *)
implementation
{$R *.DFM}
procedure TfmMain.FormCreate(Sender: TObject);
var
lListItem : TListItem;
i : Integer;
begin
for i := 0
to 9
do begin
lListItem := lvData.Items.Add;
lListItem.Caption := '
Bez1';
lListItem.SubItems.Add('
Bez2');
end;
end;
(* +------------------------------------------------------------------------+ *)
procedure TfmMain.lvDataAdvancedCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
var
lRect : TRect;
procedure PaintCB;
var
i : Integer;
begin
if (cdsSelected
in State)
then begin
imOk.Canvas.Brush.Color := clHighlight;
end else begin
imOk.Canvas.Brush.Color := clWindow;
end;
Sender.Canvas.Draw(lvData.Columns[0].Width + lvData.Columns[1].Width +
((lvData.Columns[2].Width - imOk.Width)
div 2),
lRect.Top, imOk.Picture.Bitmap);
end;
begin
if (SubItem = 2)
then begin
lRect := Item.DisplayRect(drSelectBounds);
PaintCB;
DefaultDraw := true;
end;
end;
end.