我自定义了一个护展中Timer控件的类,Delphi中已实现,在CB中搞不定,谢谢大家
时间:2011-12-27
来源:互联网
#ifndef Unit11H
#define Unit11H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
//
class TRestTimmer: public TTimer
{
private:
AnsiString FRestTypeCode;
int FRestTimeLength;
TDateTime FBeginRestTime;
bool FIsRunning;
public:
__fastcall TRestTimmer(TComponent* Owner);
__property AnsiString RestTypeCode = {read=FRestTypeCode,write=FRestTypeCode};
__property int RestTimeLength = {read=FRestTimeLength,write=FRestTimeLength};
__property TDateTime BeginRestTime ={read=FBeginRestTime,write=FBeginRestTime};
__property bool IsRunning ={read=FIsRunning,write=FIsRunning};
};
class TForm11 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TEdit *Edit1;
void __fastcall FormCreate(TObject *Sender);
private: // User declarations
TRestTimer *RestTimer;
public: // User declarations
__fastcall TForm11(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm11 *Form11;
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
#include <vcl.h>
#include <RestTimer.hpp>
#pragma hdrstop
#include "Unit11.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm11 *Form11;
//---------------------------------------------------------------------------
__fastcall TForm11::TForm11(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm11::FormCreate(TObject *Sender)
{
RestTimer = new TRestTimer(NULL);
}
//---------------------------------------------------------------------------
__fastcall TRestTimmer::TRestTimmer(TComponent* Owner)
: TTimer(Owner)
{
}
作者: liuhengwinner 发布时间: 2011-12-27
作者: liuhengwinner 发布时间: 2011-12-27
void __fastcall TForm1::FormCreate(TObject *Sender)
{
RestTimer = new TRestTimmer(NULL);
}
//---------------------------------------------------------------------------
__fastcall TRestTimmer::TRestTimmer(TComponent* Owner)
: TTimer(Owner)
{
}
作者: ksrsoft 发布时间: 2011-12-27
作者: huakeidelukou 发布时间: 2011-12-27
作者: liuhengwinner 发布时间: 2011-12-27
C/C++ code
------------头文件------------------------------- #ifndef Unit1H #define Unit1H #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> class TRestTimmer: public TTimer { private: AnsiString FRestTypeCode; int FRestTimeLength; TDateTime FBeginRestTime; bool FIsRunning; public: __fastcall TRestTimmer(TComponent* Owner); __property AnsiString RestTypeCode = {read=FRestTypeCode,write=FRestTypeCode}; __property int RestTimeLength = {read=FRestTimeLength,write=FRestTimeLength}; __property TDateTime BeginRestTime ={read=FBeginRestTime,write=FBeginRestTime}; __property bool IsRunning ={read=FIsRunning,write=FIsRunning}; }; class TForm1 : public TForm { __published: // IDE-managed Components void __fastcall FormCreate(TObject *Sender); private: // User declarations TRestTimmer *RestTimer; public: // User declarations __fastcall TForm1(TComponent* Owner); }; extern PACKAGE TForm1 *Form1; #endif -------------cpp文件----------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } void __fastcall TForm1::FormCreate(TObject *Sender) { RestTimer = new TRestTimmer(NULL); } __fastcall TRestTimmer::TRestTimmer(TComponent* Owner) : TTimer(Owner) { }
作者: ksrsoft 发布时间: 2011-12-27
作者: loveheronly 发布时间: 2011-12-27
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28