Hai HoRo,
ersteinmal: "Herzlich Willkommen in der Delphi-PRAXiS"
Ich habe hier ein Beispiel wie man es machen kann:
Delphi-Quellcode:
uses
CommCtrl;
procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: integer; State: TCustomDrawState; var DefaultDraw: boolean);
var
drawstate: cardinal;
rect: TRect;
begin
DefaultDraw := False;
drawstate := 0;
if (SubItem = 1) then
begin
drawstate := DT_RIGHT;
Sender.Canvas.Brush.Color := clBlack;
Sender.Canvas.Font.Color := clLime;
end;
if (SubItem = 2) then
begin
drawstate := DT_VCENTER or DT_CENTER;
Sender.Canvas.Brush.Color := clWhite;
Sender.Canvas.Font.Color := clBlack;
end;
ListView_GetSubItemRect(Sender.Handle, Item.Index, SubItem, LVIR_BOUNDS, @rect);
DrawText(Sender.Canvas.Handle, PChar(Item.Caption),
Length(Item.Caption), rect, drawstate);
end;
Stephan B.
"Lasst den Gänsen ihre Füßchen"