📄 currencyedit.cpp
字号:
/* --------------------------------------------------------------------------
* CurrencyEdit
*
* 程序作者:林华锋
* 创建日期:2001-11-22
* 修改日期:2001-11-25
*
* ==========================================================================
* LCSOFT货币输入控件
*/
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "CurrencyEdit.h"
#include "CeAbout.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TCurrencyEdit *)
{
new TCurrencyEdit(NULL);
}
//---------------------------------------------------------------------------
namespace Currencyedit
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TCurrencyEdit)};
RegisterComponents("Lcsoft", classes, 0);
RegisterComponentEditor(__classid(TCurrencyEdit),
__classid(TCurrencyEditor));
RegisterPropertyEditor(AnsiStringTypeInfo(),
NULL,
"About",
__classid(TCeAboutProperty));
}
}
//---------------------------------------------------------------------------
/* TCurrencyEditor */
//---------------------------------------------------------------------------
__fastcall TCurrencyEditor::TCurrencyEditor(TComponent* AComponent, _di_IFormDesigner ADesigner)
: TDefaultEditor(AComponent, ADesigner)
{
//TODO: TCurrencyProperty
}
//---------------------------------------------------------------------------
__fastcall TCurrencyEditor:: ~TCurrencyEditor()
{
//TODO: ~TCurrencyProperty
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyEditor::EditProperty(TPropertyEditor* PropertyEditor, bool& Continue, bool& FreeEditor)
{
if (PropertyEditor->GetName() == "About")
{
PropertyEditor->Edit();
Continue = false;
}
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyEditor::ExecuteVerb(int Index)
{
if (Index == 0)
{
Edit();
}
}
//---------------------------------------------------------------------------
AnsiString __fastcall TCurrencyEditor::GetVerb(int Index)
{
AnsiString sMenuContext = "";
if (Index == 0)
{
sMenuContext = "About...";
}
return sMenuContext;
}
//---------------------------------------------------------------------------
int __fastcall TCurrencyEditor::GetVerbCount(void)
{
return 1;
}
//---------------------------------------------------------------------------
/* TCeAboutProperty */
//---------------------------------------------------------------------------
__fastcall TCeAboutProperty::TCeAboutProperty(const _di_IFormDesigner ADesigner, int APropCount)
: TClassProperty(ADesigner, APropCount)
{
//TODO: TCeAboutProperty
}
//---------------------------------------------------------------------------
__fastcall TCeAboutProperty::~TCeAboutProperty()
{
//TODO: ~TCeAboutProperty
}
//---------------------------------------------------------------------------
TPropertyAttributes __fastcall TCeAboutProperty::GetAttributes(void)
{
return (TPropertyAttributes() << paDialog);
}
//---------------------------------------------------------------------------
void __fastcall TCeAboutProperty::Edit()
{
CeAboutForm = new TCeAboutForm(Application);
CeAboutForm->ShowModal();
delete CeAboutForm;
}
//---------------------------------------------------------------------------
/* TCurrencyTitle */
//---------------------------------------------------------------------------
__fastcall TCurrencyTitle::TCurrencyTitle(void) : TPersistent()
{
FFont = new TFont();
FTransparent = true;
FFont->OnChange = Changed;
}
//---------------------------------------------------------------------------
__fastcall TCurrencyTitle::~TCurrencyTitle(void)
{
delete FFont;
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyTitle::SetFont(TFont *Value)
{
FFont->Assign(Value);
Changed(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyTitle::SetTransparent(bool Value)
{
FTransparent = Value;
Changed(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyTitle::Changed(TObject *Sender)
{
FOnChange(this);
}
//---------------------------------------------------------------------------
/* TCurrencyBody */
//---------------------------------------------------------------------------
__fastcall TCurrencyBody::TCurrencyBody(void) : TPersistent()
{
FDotLineColor = clRed;
FSplitLineColor = clSilver;
FKilobitLineColor = clBlack;
FCurrencyAlignment = caCenter;
FFont = new TFont();
FFont->OnChange = Changed;
}
//---------------------------------------------------------------------------
__fastcall TCurrencyBody::~TCurrencyBody(void)
{
delete FFont;
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::SetFont(TFont *Value)
{
FFont->Assign(Value);
Changed(NULL);
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::SetDotLineColor(TColor Value)
{
if (Value != FDotLineColor)
{
FDotLineColor = Value;
Changed(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::SetSplitLineColor(TColor Value)
{
if (Value != FSplitLineColor)
{
FSplitLineColor = Value;
Changed(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::SetKilobitLineColor(TColor Value)
{
if (Value != FKilobitLineColor)
{
FKilobitLineColor = Value;
Changed(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::SetCurrencyAlignment(TCurrencyAlignment Value)
{
if (Value != FCurrencyAlignment)
{
FCurrencyAlignment = Value;
Changed(NULL);
}
}
//---------------------------------------------------------------------------
void __fastcall TCurrencyBody::Changed(TObject *Sender)
{
FOnChange(this);
}
//---------------------------------------------------------------------------
/* TCurrencyEdit */
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -