如何快速清空画布

yiyanghuadan 2002-11-14 08:41:15
有问题如下:
在一个TPaintBox上做图(主要是画曲线),其下有图象背景,因为要进调整曲线的整,所以要快速地清除其上的曲线,但又不能影响图象背景
请问如何快速清除呀

不要告诉我
Graphics::TBitmap temp=new Graphics::TBitmap;
temp->Height=xxx;
temp->Width=yyy;
PaintBox1->Draw(0,0,temp);
我要的是快速
...全文
664 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
CoolSoftBird 2002-11-20
  • 打赏
  • 举报
回复
PaintBox->Canvas->Refresh()不行
dahuzizyd 2002-11-19
  • 打赏
  • 举报
回复
这个程序主要是利用TList对操作前的图象进行保存,进行撤消操作时再从TList中调用,你试试吧,肯定是可行的,不过可能还要在调试一下。
TList *myList = new TList(); //声明一个TList类

void __fastcall TForm1::Button2Click(TObject *Sender)
{ //画图
Image1->Picture->Bitmap->Canvas->Brush->Color = clBlue;
Image1->Picture->Bitmap->Canvas->Rectangle(50,50,200,200);
Graphics::TBitmap * bitmap1 = new Graphics::TBitmap();
bitmap1 -> Assign ( Image1 -> Picture -> Bitmap);
myList -> Add( bitmap1);
i = i + 1;

void __fastcall TForm1::Button3Click(TObject *Sender)
{ //撤消操作
//Image1->Picture->Bitmap->Handle= myList->Items[0] ;
//int i ;
//i = myList->Count-2 ;
Image1->Picture->Bitmap-> Assign ( (Graphics::TBitmap*)myList -> Items[i-2] );
i = i - 1;
//if ( (Graphics::TBitmap*)myList -> Items[i+1] )
//delete ((Graphics::TBitmap*)myList -> Items[i+1] );
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Graphics::TBitmap * bitmap1 = new Graphics::TBitmap();
bitmap1 -> Assign ( Image1 -> Picture -> Bitmap);
myList -> Add( bitmap1);
i = i + 1;

}
liux330 2002-11-18
  • 打赏
  • 举报
回复
PaintBox1->Canvas->Brush->Bitmap = NULL;
meCAD 2002-11-18
  • 打赏
  • 举报
回复
用PaintBox1->Canvas->Rectangle(0,0,100,100);
矩形覆盖掉原来的画面
或者PaintBox1->Canvas->FillRect(PaintBox1->ClientRect);
jianlinlong 2002-11-15
  • 打赏
  • 举报
回复
PaintBox1->Canvas->Refresh();
tjzzx888 2002-11-15
  • 打赏
  • 举报
回复
to jianlinlong(楚 潇)
PaintBox1->Canvas->Refresh();不行吧,我也不知道
关注
pzoon 2002-11-14
  • 打赏
  • 举报
回复
PaintBox1->Canvas->FillRect(PaintBox1->ClientRect
Libran 2002-11-14
  • 打赏
  • 举报
回复
PaintBox1->Canvas->FillRect(PaintBox1->ClientRect);

13,871

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧