Recent

Author Topic: Fix flicker in Sprite example code  (Read 4975 times)

Windsurfer

  • Sr. Member
  • ****
  • Posts: 368
    • Windsurfer
Fix flicker in Sprite example code
« on: November 20, 2007, 11:44:26 pm »
I am not very active, and am not sure where to post this, or how to add it to the code examples. Add 'Doublebuffered := True;' to stop flickering in the sprite code example, as below.

procedure TPlayGroundForm.PlayGroundFormCreate(Sender: TObject);
begin
  PictureControl:=TPictureControl.Create(Self);
  with PictureControl do begin
    Parent:=Self;
    Align:=alClient;
    //To stop flicker add following line
    Doublebuffered := True;
  end;

  SpriteImg:=TPortableNetworkGraphic.Create;
  BackgroundImg:=TBitmap.Create;
  BufferImg:=TBitmap.Create;

  SpriteImg.LoadFromFile(SetDirSeparators('../../images/ide_icon48x48.png'));
  BackgroundImg.LoadFromFile(SetDirSeparators('../../images/lazarus.xpm'));
  BufferImg.Width:=BackgroundImg.Width;
  BufferImg.Height:=BackgroundImg.Height;
 
  UpdateImage;
end;

 

TinyPortal © 2005-2018