1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
procedure TForm1.AdvListView1AdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
var
rect : TRect;
OldBrushCol : TColor;
OldBrushStyle : TBrushStyle;
OldPenCol : TColor;
OldPenStyle : TPenStyle;
OldPenMode : TPenMode;
begin
if (Stage = cdPostPaint) then
begin
{sauvegarde de brush et pen}
OldBrushCol := Sender.Canvas.Brush.Color;
OldBrushStyle := Sender.Canvas.Brush.Style;
OldPenCol := Sender.Canvas.Pen.Color;
OldPenStyle := Sender.Canvas.Pen.Style;
OldPenMode := Sender.Canvas.Pen.Mode;
Sender.Canvas.Brush.Color := {get item color}
Sender.Canvas.Pen.Style := psClear;
{récupération du rectangle cible}
rect:=Item.DisplayRect(drIcon);
{dessin du rectangle}
Sender.Canvas.RoundRect(rect.Left,rect.top,rect.right,rect.bottom,10,10);
{récupération des anciennes valeurs de brush et pen}
Sender.Canvas.Brush.Color:=OldBrushCol;
Sender.Canvas.Brush.Style:=OldBrushStyle;
Sender.Canvas.Pen.Color:=OldPenCol;
Sender.Canvas.Pen.Style:=OldPenStyle;
Sender.Canvas.Pen.Mode:=OldPenMode;
end;
end; |
Partager