Lazarus

Programming => Graphics and Multimedia => Graphics => Topic started by: Windsurfer on November 20, 2007, 11:44:26 pm

Title: Fix flicker in Sprite example code
Post by: Windsurfer 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