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 Ereignisroutine OnDrawCell(...) in eine Komponente auslagern (https://www.delphipraxis.net/84062-ereignisroutine-ondrawcell-eine-komponente-auslagern.html)

EccoBravo 10. Jan 2007 19:31


Ereignisroutine OnDrawCell(...) in eine Komponente auslagern
 
Hallo,

wie kann ich eine Ereignisroutine OnDrawCell aus dem StringGrid1 eines TForm1

Delphi-Quellcode:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState; Farbe:TColor);
begin
...
end;


in eine von TStringGrid abgeleitete Komponente TEB_StringGrid

Delphi-Quellcode:
TEB_StringGrid = Class(TStringGrid);
...
end;
verschieben?

Ich möchte nämlich in einer neuen Komponente TEB_StringGrid die Zellfarbgebung und die Typenwandlung von Single in String usw. mit übernehmen

Ich habe folgendes Problem dabei:

In dem TForm1.StringGrid1 heißt diese Ereignisroutine

Delphi-Quellcode:
TForm1.StringGrid1DrawCell(...)
aber in der Komponente müßte diese als

Delphi-Quellcode:
TEB_StringGrid.DrawCell(..)
aufgelöst werden, und dann wäre da noch die Parameterliste.

Würde dieses der Compiler verstehen?

Vielen Dank für Hilfe

E. B.

mkinzler 10. Jan 2007 19:34

Re: Ereignisroutine OnDrawCell(...) in eine Komponente ausla
 
.OnDrawCell ist eine Event-Property, also eine Referenz auf eine Methode, diese Methode ist ja im Standardfall auch keine Methode des Grids sondern der Form.

EccoBravo 10. Jan 2007 19:55

Re: Ereignisroutine OnDrawCell(...) in eine Komponente ausla
 
Danke, danke!

Ja, und was mache ich da?

Gruß eb

mkinzler 10. Jan 2007 19:59

Re: Ereignisroutine OnDrawCell(...) in eine Komponente ausla
 
Delphi-Quellcode:
TEB_StringGrid1.onDrawwCell := Form1.StringGrid1DrawCell;
bzw. durch Setzen im OI

EccoBravo 10. Jan 2007 20:03

Re: Ereignisroutine OnDrawCell(...) in eine Komponente ausla
 
Danke,

und TEB_StringGrid1.onDrawwCell kann ich dann im Code der Komponente ausimplementieren?

Hmm, in der Komponente habe ich aber keinen OI.

Grüße

E. B.

mkinzler 10. Jan 2007 20:11

Re: Ereignisroutine OnDrawCell(...) in eine Komponente ausla
 
In diesem Falle wäre es besser .DrawCellzu Überschreiben.


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:07 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