C++ Builder




- 42


property bool LEDOn= { read= FOnOff,write= SetOnOff) ; property l OnColor= { read=FOnColor,write=SetOnColor} ; :.,. __property TColor OffColor=

{ read=FOff Color, write= SetOffColor} ;

};

//_____________-___-_----____________------------------

#endif

6.15. LED.h .

LED.cpp ( 6.16). , .

#include <vcl\vcl.h>

#pragma hdrstop

# include "LED.h" //_------------____-----------.------------

static inline TLED *ValidCtrCheck() {

return new TLED(MULL) ;

)

void _fastcall TLED::SetOnOf?(const bool Value) {

POnOff = Value;

Brush->Color (POnOff) ? FOnColor : POffColor?

}

//_--^-.-..

void _fastcall TLED::SetOnColor(const TColor OnColor) {

POnColor = OnColor;

Brush->Color = (FOnOff) ? FOnColor : FOffColor;

}

//--------------------------------

void _fastcall TLED::SetOfColor(const TColor OffColor) {

FOffColor = OffColor;

Brush->Color = (FOnOff) ? FOnColor : FOffColor;

}

//---_------------------------------------------------------

_fastcall TLED::TLED(TComponent* Owner) : TShape(Owner)

{

Width = 15; // Height = 15; // FOnColor = cILime; //

, FOffColor = cIRed; // , FOnOff = false; //

Shape ? atEllipse; // Pen->Color = clBlack; //

Pen->Width = 2; // Brush->Color ^ FOffColor; //

}

//---------------____-______________________--________.

namespace Led

{

void _fastcall Register () {

TComponentClass classes[1] = {__classid(TLED)} ;

RegisterComponents("Samples", classes, 0) ;

} }