Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:2k
- //---------------------------------------------------------------------------
- #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();
- }
- //---------------------------------------------------------------------------