救人啊!移动防抖怎么做啊..

nhczp nhczp 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
这里是源码:
移出的效果是上移.
试了好多方法就是不行.
图画在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;
} */
}
...全文
评论 6
收藏 已收藏
分享
返回顶部
nhczp
茶馆 551 成员 20,044 内容