救人啊!移动防抖怎么做啊..
nhczp 2006-12-07 09:53:16 这里是源码:
移出的效果是上移.
试了好多方法就是不行.
图画在FORM上面form名为show_win
Integer i,j,k,flag;
TRect Dct;
j = show_win->Height; //获得表单高度
Graphics::TBitmap *newbmp = new Graphics::TBitmap;
Graphics::TBitmap *v_showbmp = new Graphics::TBitmap;
Graphics::TBitmap *v_display = new Graphics::TBitmap;
newbmp->Width = show_win->Width;
newbmp->Height = show_win->Height;
v_showbmp->Width = show_win->Width;
v_showbmp->Height = show_win->Height;
show_win->Canvas->Brush->Color = RGB(255,0,0); //每次画矩形的画刷颜色
for(i=0;i< j;i++) //这里为画线
{
Dct = Rect(0,i,show_win->Width,i+1); //每次刷绘的矩形区域
show_win->Canvas->FillRect(Dct); //填充颜色
// Application->ProcessMessages();
i = i + 19;
}
newbmp->Canvas->CopyRect(Rect(0,0,show_win->Width,show_win->Height),
show_win->Canvas,
Rect(0,0,show_win->Width,show_win->Height));
// show_win->Image1->Stretch = true;
show_win->DoubleBuffered = true;
Form1->DoubleBuffered = true;
// show_win->Image1->Parent->DoubleBuffered = true;
// show_win->Parent->DoubleBuffered = true;
LockWindowUpdate(show_win->Handle);
for(i = 0;i<=j;i++)
{
v_showbmp->Canvas->CopyRect(Rect(0,show_win->Height - i,show_win->Width,show_win->Height),
newbmp->Canvas,
Rect(0,0,show_win->Width,i)); //由下往上移,此为拷贝移入
v_showbmp->Canvas->CopyRect(Rect(0,0,show_win->Width,show_win->Height - i),
newbmp->Canvas,
Rect(0,i,show_win->Width,show_win->Height));//此为拷贝移出
show_win->Canvas->Draw(0,0,v_showbmp); //画图
Application->ProcessMessages();
Sleep(10);
LockWindowUpdate(0);
/* if(i == j)
{
i=0;
} */
}