X
xgbing
Unregistered / Unconfirmed
GUEST, unregistred user!
PaintBox画图问题:主要是要显示几个复杂的数据波形,还要定时刷新,如果用普通的办法
void __fastcall TForm1:aintBox1Paint(TObject *Sender)
{
PaintBox1->Canvas->Pen->Color=clRed;
...画刻度
. . .
画波形1,2,3...
for(...)
{
PaintBox1->Canvas->MoveTo(..);
PaintBox1->Canvas->LintTo(...);
}
}
....
但每刷新一次数据,屏幕就会闪一次
后改为:
定义全局变量Graphics::TBitmap* bufBitmap;
数据每改变一次,重画bufBitmap一次
void __fastcall TForm1:aintBox1Paint(TObject *Sender)
{
PaintBox1->Canvas->CopyRect(PaintBox1->ClientRect,bufBitmap->Canvas,bufBitmap->Canvas->ClipRect);
}
请教各位大哥有没有更好的办法,你们做过这样的程序吗,给点意见吧!
void __fastcall TForm1:aintBox1Paint(TObject *Sender)
{
PaintBox1->Canvas->Pen->Color=clRed;
...画刻度
. . .
画波形1,2,3...
for(...)
{
PaintBox1->Canvas->MoveTo(..);
PaintBox1->Canvas->LintTo(...);
}
}
....
但每刷新一次数据,屏幕就会闪一次
后改为:
定义全局变量Graphics::TBitmap* bufBitmap;
数据每改变一次,重画bufBitmap一次
void __fastcall TForm1:aintBox1Paint(TObject *Sender)
{
PaintBox1->Canvas->CopyRect(PaintBox1->ClientRect,bufBitmap->Canvas,bufBitmap->Canvas->ClipRect);
}
请教各位大哥有没有更好的办法,你们做过这样的程序吗,给点意见吧!