604
社区成员
发帖
与我相关
我的任务
分享
brsh->LoadFromFile(".//Data//test.bmp");
img1->Canvas->Brush->Bitmap = brsh;
img1->Canvas->FillRect(img1->ClientRect);
img1->Canvas->Brush->Bitmap = NULL;
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int i = 0;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Graphics::TBitmap *BrushBmp = new Graphics::TBitmap;
try
{
BrushBmp->LoadFromFile("C:\\11.bmp");
BitBlt(Image1->Canvas->Handle,0,0,Image1->Width,Image1->Height,BrushBmp->Canvas->Handle,0,0,SRCCOPY);
Memo1->Lines->Add(IntToStr(i++)) ;
}
__finally
{
delete BrushBmp;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//连续刷新10次 也就是OnPaint事件连续触发10次
for(int n=0;n<40;n++)
Form1->Refresh();
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
DoubleBuffered = true ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormPaint(TObject *Sender)
{
Graphics::TBitmap *BrushBmp = new Graphics::TBitmap;
try
{
BrushBmp->LoadFromFile("C:\\11.bmp");
Image1->Canvas->Brush->Bitmap = BrushBmp;
Image1->Canvas->FillRect(Image1->ClientRect);
}
__finally
{
Form1->Canvas->Brush->Bitmap = NULL;
delete BrushBmp;
}
}