604
社区成员




class PACKAGE TXXColor: public Classes::TPersistent
{
public:
// ..............
private:
//........
__published:
__property TRGB* RGB={read=GetRGBValue,write=SetRGBValue} ;
__property THSL* HSL={read=GetHSLValue,write=SetHSLValue} ;
};
class PACKAGE TRGBProperty:public TClassProperty
{
public:
inline __fastcall virtual TRGBProperty(const Designintf::_di_IDesigner ADesigner, int APropCount)
:TClassProperty(ADesigner,APropCount)
{
}
TPropertyAttributes __fastcall GetAttributes(void)
{
return TPropertyAttributes()<<paSubProperties;
}
};
namespace xxx
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid( TXXColor)};
RegisterComponents("Samples", classes, 0);
RegisterPropertyEditor(__typeinfo(TRGB),__classid( TXXColor),
"RGB",__classid(TRGBProperty));
RegisterPropertyEditor(__typeinfo(THSL),__classid( TXXColor),
"HSL",__classid(THSLProperty));
}
}
// 另外好像你需要注册1个窗体来辅助完成你的子对象 RGB,HSL属性的编辑,只给了框架代码
{伪代码}
xxColor = class(TCustomControl)
published
R, G, B: Byte;
H, S, L: Byte;
C, M, Y, K: Byte;
end;
xxRGB = class(TPersistent)
published
R, G, B: Byte;
end;
xxColor = class(TCustomControl)
published
RGB: xxRGB;
HSL: xxHSL;
public
R, G, B: Byte;
H, S, L: Byte;
C, M, Y, K: Byte;
end;