Einzelnen Beitrag anzeigen

Benutzerbild von dataspider
dataspider

Registriert seit: 9. Nov 2003
Ort: 04539 Groitzsch
1.350 Beiträge
 
Delphi 11 Alexandria
 
#6

Re: TcxGrid, Grafiken einbinden

  Alt 29. Jun 2009, 06:31
Hi,

wenn die Grafik zu einer Column gehört und in einer ImageList liegt, mache ich es so:

Delphi-Quellcode:
procedure TMainForm.gvCustomDrawCell(Sender:
    TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo:
    TcxGridTableDataCellViewInfo; var ADone: Boolean);
const
  ImageIndent = 3;
var
  AImageRect, ATextRect: TRect;
begin
  ACanvas.Brush.Color := AViewInfo.Params.Color;
  ACanvas.FillRect(AViewInfo.Bounds);
  AImageRect := AViewInfo.ContentBounds;
  AImageRect.Left := AImageRect.Left + ImageIndent;
  AImageRect.Right := AImageRect.Left + ImageList.Width;
  ATextRect := AViewInfo.ContentBounds;
  ATextRect.Left := AImageRect.Right + ImageIndent;
  ACanvas.DrawImage(ImageList, AImageRect.Left, AImageRect.Top, AViewInfo.Item.Tag);
  ACanvas.DrawTexT(AViewInfo.Text, ATextRect, DT_SINGLELINE or DT_LEFT);
  ADone := True;
end;
Methode OnCustomDrawCell der Column...

Cu, Frank
Frank Reim
  Mit Zitat antworten Zitat