drawthrd.cpp
来自「《bcb深度历险》 电子书」· C++ 代码 · 共 63 行
CPP
63 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "DrawThrd.h"
#include "xFonts.hpp"
#include <registry.hpp>
#include "util.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall Unit1::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall TDrawThread::TDrawThread(HWND Wnd)
: TThread(false)
{
randomize();
FreeOnTerminate = True;
FWnd = Wnd;
FEssay = new TStringList;
TRegIniFile* r = new TRegIniFile(REGISTRY_KEY);
try {
FMoveSpeed = r->ReadInteger(SEC_GENERAL, REG_MOVESPEED, 5);
FDelayTime = r->ReadInteger(SEC_GENERAL, REG_MOVEDELAYTIME, 10);
FClearDelayTime = r->ReadInteger(SEC_GENERAL, REG_CLEARDELAYTIME, 10);
FChangeDelayTime = r->ReadInteger(SEC_GENERAL, REG_CHANGEDELAYTIME, 5000);
} __finally {
delete r;
}
GetClientRect(FWnd, &FWindowRect);
FWindowWidth = FWindowRect.Right;
FWindowHeight = FWindowRect.Bottom;
FWindowMiddleY = FWindowHeight / 2;
}
//---------------------------------------------------------------------------
__fastcall TDrawThread::~TDrawThread()
{
delete FEssay;
}
//---------------------------------------------------------------------------
void __fastcall TDrawThread::Execute()
{
do {
ChooseAndLoadEssay(); // 匡拒
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?