Paint() aufrufen bei Propertyänderung
-
Hallo Forum,
ich habe mir von TGraphicControl abgeleitet eine Art Progress-Bar gebastelt:
class PACKAGE TProgress : public TGraphicControl { protected: virtual void __fastcall Paint(); // ... __published: __property int Percent = {read = iPercent, write = iPercent}; __property TColor ProgressColor = {read =clProgrCol, write=clProgrCol}; __property TColor BackgroundColor = {read =clBgrdCol, write=clBgrdCol}; __property bool ShowPercent = {read = bShowPercent, write=bShowPercent}; };
Wie kann ich es nun anstellen, dass bei jedem write-Zugriff auf die Properties
Paint() aufgerufen wird?
Set-/Get-Methoden will ich nach Möglichkeit vermeiden!MfG Chris_
-
Chris_ schrieb:
Wie kann ich es nun anstellen, dass bei jedem write-Zugriff auf die Properties Paint() aufgerufen wird?
Setter verwenden. Dafür sind sie da.
-
Vielen Dank an audacia, jetzt funktionierts!
-
Ich hoffe aber, du rufst Paint() nicht direkt auf, sondern verwendest "Invalidate()".