为什么我用双缓冲了,绘图还是有闪烁,用的GDI+
想绘制上面的圆圈的旋转,在内存中,用bitmap绘制,然后绘制好了,一次性用BitBlp绘制,让圆圈旋转,可是发现旋转的时候,图形会闪烁,到底怎么样才能不闪烁呢?
procedure TForm1.Tmr_2Timer(Sender: TObject);
var
aImg:TBitmap ;
CirImage:TGPImage ;
gpImg:TGPGraphics ;
pbleft,pbtop:single ;
RotateP:TGPPointF ;
gpMatrix:TGPMatrix;
gpRec:TGPRectF ;
begin
rotateAngle :=rotateAngle -10;
aImg:= TBitmap.Create ;
aImg.Width :=140;
aImg.Height:=140;
CirImage :=TGPImage.Create(WideString(ExtractFilePath(ParamStr(0))+'Images\66.png'));
gpImg:=TGPGraphics.Create(aImg.Canvas.Handle );
RotateP.X :=20+60;
RotateP.Y :=20+60;
gpMatrix :=TGPMatrix.Create ;
gpMatrix.RotateAt(rotateAngle,RotateP ) ;
gpImg.SetTransform(gpMatrix );
gpRec.X :=20;
gpRec.Y :=20;
gpRec.Width :=120;
gpRec.Height :=120;
gpImg.DrawImage(CirImage,gprec) ;
Self.Refresh ;//强行刷新窗体,让原来画的图清除
BitBlt(Self.Canvas.Handle ,0,0,140,140,aImg.Canvas.Handle ,0,0,SRCAND) ;
aImg.Free ;
CirImage.Free ;
gpImg.Free ;
end;