📄 unit1.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)
{
BK = new Graphics::TBitmap();
BK->Width=PaintBox1->Width;
BK->Height=PaintBox1->Height;
blFlash=True;
xx=20;yy=20;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::PaintBox1Paint(TObject *Sender)
{
if(blFlash)
{
PaintBox1->Canvas->Brush->Color=clWhite;
PaintBox1->Canvas->FillRect(TRect(0,0,PaintBox1->Width,PaintBox1->Height));
PaintBox1->Canvas->TextOut(xx,yy,"中华人民共和国");
xx+=6;yy+=6;
}
else
{
BK->Canvas->Brush->Color=clWhite;
BK->Canvas->FillRect(TRect(0,0,BK->Width,BK->Height));
BK->Canvas->TextOut(xx,yy,"全国人民代表大会");
// PaintBox1->Canvas->CopyMode=cmSrcCopy;
BitBlt(PaintBox1->Canvas->Handle,0,0,PaintBox1->Width,PaintBox1->Height,BK->Canvas->Handle,0,0,SRCCOPY);
// PaintBox1->Canvas->CopyRect(Rect(0,0,PaintBox1->Width,PaintBox1->Height),BK->Canvas,Rect(0,0,PaintBox1->Width,PaintBox1->Height));
xx+=6;yy+=6;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
blFlash=True;
PaintBox1->Invalidate();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete BK;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
blFlash=False;
PaintBox1->Invalidate();
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -