Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Control in TDBGrid-Spalte zeichnen (https://www.delphipraxis.net/23078-control-tdbgrid-spalte-zeichnen.html)

Stevie 28. Mai 2004 13:39


Control in TDBGrid-Spalte zeichnen
 
Hey Leute,

ich versuche gerade, ein Control in ein TDBGrid-Objekt zu bekommen, aber irgendwie schaff ich es nicht. Wie stell ich es an, dass in jeder Zeile einer Spalte eine ProgressBar gezeichnet wird. Sie soll den Wert, der dort im TField steht als Fortschritt anzeigen. Ich möchte auf keine andere fertige Komponente ausweichen, sondern es gerne selber (mit eurer tatkräftigen Hilfe, natürlich :wink:) schaffen!

Stevie 3. Jun 2004 10:25

Re: Control in TDBGrid-Spalte zeichnen
 
:cry: Keiner hilft mir! :wink:
Also hab ich mal selber etwas rumgebastelt:
Delphi-Quellcode:
procedure TForm1.DBGridDrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if (Column.FieldName = 'Fortschritt') and
   not ClientDataSet.FieldByName('Thread').IsNull then
  begin
    ProgressBar.Max := ClientDataSet.FieldValues['Size'];
    ProgressBar.Position := ClientDataSet.FieldValues['Fortschritt'];
    ProgressBar.BoundsRect := Rect;
    ProgressBar.PaintTo(DBGrid.Canvas, Succ(Rect.Left), Succ(Rect.Top));
  end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz