怎样实现以特效显示图像?
百叶窗的特效………………
=======================
代码……让你疯狂
=======================
问题点数:100、回复次数:2Top
1 楼yyyyin(yyyy)回复于 2002-04-12 13:21:45 得分 40
define a private variable 'Graphics::TBitmap *bmp'
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
bmp = 0;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(OpenPictureDialog1->Execute()){
if(bmp)
delete bmp;
bmp = new Graphics::TBitmap;
bmp->LoadFromFile(OpenPictureDialog1->FileName);
Paint();
}
}
void __fastcall TForm1::FormPaint(TObject *Sender)
{
if(bmp){
int group = 10;
int count = bmp->Height / group;
for(int i=0; i<count; i++)
for(int j=0; j<group; j++){
bmp->Canvas->CopyRect(TRect(0, count*j+i-1, bmp->Width, count*j+i),
Canvas, TRect(0, count*j+i-1, bmp->Width, count*j+i));
::Sleep(10);
Canvas->Draw(10,10,bmp);
}
}
}Top
2 楼Cbfan(民族英雄~~)回复于 2002-04-12 16:51:24 得分 60
从一个图形 百叶窗转变成另一个图形。
下面是代码,别忘了给分~~
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *image1=new Graphics::TBitmap();
Graphics::TBitmap *image2=new Graphics::TBitmap();
image2->LoadFromFile("1.bmp");
image1->LoadFromFile("2.bmp");
int i,j,bmpheight,bmpwidth,xgroup,xcount;
image1->Width=image2->Width;
image1->Height=image2->Height;
bmpheight=image2->Height;
bmpwidth=image2->Width;
xgroup=16;
xcount=div(bmpheight,xgroup).quot;
for(i=0;i<=xcount;i++)
{
for(j=0;j<xgroup;j++)
{
image1->Canvas->CopyRect(Rect(0,xcount*j+i-1,
bmpwidth,xcount*j+i),
image2->Canvas,Rect(0,xcount*j+i-1,
bmpwidth,xcount*j+i));
Form1->Canvas->Draw(10,10,image1);
}
}
delete image1,image2;
}
//---------------------------------------------------------------------------Top




