Initial commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#ifndef CKBoxH
|
||||
#define CKBoxH
|
||||
#include <vcl.h>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TCKBox : public TPanel
|
||||
{
|
||||
private:
|
||||
bool FChecked;
|
||||
bool FEnabled;
|
||||
bool bMouse;
|
||||
bool FAutoBox;
|
||||
TNotifyEvent FOnChange;
|
||||
TColor FBoxColor;
|
||||
|
||||
String m_strText;
|
||||
// TLabel *m_pCaption;
|
||||
Vcl::Imaging::Pngimage::TPngImage *m_pImgCheck;
|
||||
|
||||
private:
|
||||
void __fastcall SetBoxEnabled(bool bEnabled);
|
||||
void __fastcall SetEnabled(bool bEnabled);
|
||||
void __fastcall SetChecked(bool bCheck);
|
||||
void __fastcall SetBoxColor(TColor cColor);
|
||||
TFont* __fastcall GetTextFont();
|
||||
void __fastcall SetTextFont( TFont* Value );
|
||||
// void __fastcall Clicklb(TObject *Sender);
|
||||
// TColor __fastcall ColorSub(TColor cColor,int index);
|
||||
String __fastcall GetCaption();
|
||||
void __fastcall SetCaption( String Value );
|
||||
|
||||
protected:
|
||||
virtual void __fastcall Paint(void);
|
||||
|
||||
MESSAGE void __fastcall CMMouseLeave(TWMMouse &Message);
|
||||
MESSAGE void __fastcall CMMouseEnter(TWMMouse &Message);
|
||||
MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TWMMouse, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TWMMouse, CMMouseLeave)
|
||||
MESSAGE_HANDLER(WM_SIZE, TWMSize, WMSize)
|
||||
END_MESSAGE_MAP(TPanel)
|
||||
public:
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
__fastcall TCKBox( TComponent* Owner );
|
||||
__fastcall ~TCKBox();
|
||||
|
||||
__published:
|
||||
__property bool Checked = { read = FChecked, write = SetChecked, default = 0 };
|
||||
__property bool Enabled = { read = FEnabled, write = SetEnabled, default = 1 };
|
||||
__property bool AutoBox = { read = FAutoBox,write = FAutoBox,default = 1};
|
||||
__property TColor BoxColor = { read = FBoxColor,write = SetBoxColor };
|
||||
__property Font = { read = GetTextFont, write = SetTextFont };
|
||||
__property TNotifyEvent OnChange = {read = FOnChange, write = FOnChange ,default = NULL};
|
||||
__property String Caption = {read = GetCaption, write = SetCaption };
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
使用说明
|
||||
1、OnChange 为当 Checked 发生改变时触发 为外部接口 也可以使用父类 TPanel 的 onClick
|
||||
2、FontSize 为 字体大小
|
||||
3、AutoBox 为 True 时:
|
||||
Box 的大小随字体高度变化
|
||||
为false 时:
|
||||
Box 的大小 随控件的 Height 变化
|
||||
4、BoxEnabled 能否使用 ,不与 TPanel 的 Enabled 冲突
|
||||
附注:
|
||||
控件 最小 Height 为 6 ;最小 Width 为 11
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user