⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 currencyedit.h

📁 给大家介绍一个小的C++builder软件,或许对大家在采购,超市的软件编程上有一定帮助.
💻 H
字号:

/* --------------------------------------------------------------------------
 * CurrencyEdit
 *
 * 程序作者:林华锋
 * 创建日期:2001-11-22
 * 修改日期:2001-11-25
 *
 * ==========================================================================
 * LCSOFT货币输入控件
 */

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

#ifndef CurrencyEditH
#define CurrencyEditH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>

#include <DsgnIntf.hpp>
//---------------------------------------------------------------------------
const NumCount = 12;
enum TCurrencyAlignment {caTop, caCenter, caBottom};

PTypeInfo AnsiStringTypeInfo(void)
{
        PTypeInfo pTI = new TTypeInfo;
        pTI->Name = "AnsiString";
        pTI->Kind = tkLString;
        return pTI;
}

/* TCurrencyEditor */

class PACKAGE TCurrencyEditor : public TDefaultEditor
{
private:
        //
protected:
        virtual void __fastcall EditProperty(TPropertyEditor* PropertyEditor,
                                             bool& Continue, bool& FreeEditor);
public:
        virtual void __fastcall ExecuteVerb(int Index);
	virtual AnsiString __fastcall GetVerb(int Index);
	virtual int __fastcall GetVerbCount(void);
        __fastcall TCurrencyEditor(TComponent* AComponent, _di_IFormDesigner ADesigner);
        __fastcall virtual ~TCurrencyEditor();
};

/* TCeAboutProperty */

class PACKAGE TCeAboutProperty : public TClassProperty
{
private:
        //
protected:
        //        
public:
        __fastcall TCeAboutProperty(const _di_IFormDesigner ADesigner, int APropCount);
        virtual TPropertyAttributes __fastcall GetAttributes(void);
        __fastcall virtual ~TCeAboutProperty();
        virtual void __fastcall Edit();
};

/* TCurrencyTitle */

class PACKAGE TCurrencyTitle : public TPersistent
{
private:
        TFont *FFont;
        bool FTransparent;
        TNotifyEvent FOnChange;
        void __fastcall SetFont(TFont *Value);
        void __fastcall SetTransparent(bool Value);
protected:
        void __fastcall Changed(TObject *Sender);
__published:
        __fastcall TCurrencyTitle(void);
        __fastcall ~TCurrencyTitle(void);
        __property TFont *Font = {read=FFont, write=SetFont};
        __property bool Transparent = {read=FTransparent, write=SetTransparent, default=true};
        __property TNotifyEvent OnChange = {read=FOnChange, write=FOnChange};
};

/* TCurrencyBody */

class PACKAGE TCurrencyBody : public TPersistent
{
private:
        TFont *FFont;
        TColor FDotLineColor;
        TColor FSplitLineColor;
        TColor FKilobitLineColor;
        TCurrencyAlignment FCurrencyAlignment;
        TNotifyEvent FOnChange;
        void __fastcall SetFont(TFont *Value);
        void __fastcall SetDotLineColor(TColor Value);
        void __fastcall SetSplitLineColor(TColor Value);
        void __fastcall SetKilobitLineColor(TColor Value);
        void __fastcall SetCurrencyAlignment(TCurrencyAlignment Value);
protected:
        void __fastcall Changed(TObject *Sender);
__published:
        __fastcall TCurrencyBody(void);
        __fastcall ~TCurrencyBody(void);
        __property TFont *Font = {read=FFont, write=SetFont};
        __property TColor DotLineColor = {read=FDotLineColor, write=SetDotLineColor, default=clRed};
        __property TColor SplitLineColor = {read=FSplitLineColor, write=SetSplitLineColor, default=clSilver};
        __property TColor KilobitLineColor = {read=FKilobitLineColor, write=SetKilobitLineColor, default=clBlack};
        __property TCurrencyAlignment CurrencyAlignment = {read=FCurrencyAlignment, write=SetCurrencyAlignment, default=caCenter};
        __property TNotifyEvent OnChange = {read=FOnChange, write=FOnChange};
};

/* TCurrencyEdit */

class PACKAGE TCurrencyEdit : public TCustomPanel
{
private:
        int FPenWidth;
        int FTitleLeft;
        int FCurrencyLeft;
        AnsiString FAbout;
        AnsiString FValue;
        TColor FPenColor;
        TAlignment FAlignment;
        TCurrencyTitle *FTitle;
        TCurrencyBody *FBody;
        TLabel *FTitleLabel;
        TEdit  *FNumEdit[NumCount];
        AnsiString __fastcall GetValue(void);
        void __fastcall SetAlignment(TAlignment Value);
        void __fastcall SetAbout(AnsiString Value);
        void __fastcall SetTitle(TCurrencyTitle *Value);
        void __fastcall SetBody(TCurrencyBody *Value);
protected:
        virtual void __fastcall Paint(void);
        virtual void __fastcall DoTitlePosition(TControl *Control, TAlignment Alignment, int PenWidth);
        void __fastcall DoCurrencyAlignment(TCurrencyAlignment Kind);
        void __fastcall NumEditKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
        void __fastcall NumEditKeyPress(TObject *Sender, char &Key);
public:
        __fastcall TCurrencyEdit(TComponent* Owner);
        __fastcall ~TCurrencyEdit(void);
        __property Canvas;
        __property AnsiString Value = {read=GetValue};
__published:
        void __fastcall TitleChanged(TObject* Sender);
        void __fastcall BodyChanged(TObject* Sender);
        __property TAlignment Alignment = {read=FAlignment, write=SetAlignment, default=taCenter};
        __property AnsiString About = {read=FAbout, write=SetAbout};
        __property TCurrencyTitle *Title = {read=FTitle, write=SetTitle};
        __property TCurrencyBody *Body = {read=FBody, write=SetBody};
        __property Align;
        __property Color = {default=clWhite};
        __property OnCanResize;
        __property OnClick;
        __property OnDblClick;
        __property OnEnter;
        __property OnExit;
        __property OnKeyDown;
        __property OnKeyPress;
        __property OnKeyUp;
        __property OnMouseDown;
        __property OnMouseMove;
        __property OnMouseUp;
        __property OnResize;
};
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -