I do not think the error is in the code you gave us. I have tested it and it works perfectly.
Code:
var
Form1: TForm1;
mysurface : Tdirectdrawsurface;
implementation
{$R *.DFM}
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
dxdraw1.surface.stretchdraw(rect (0,0,form1.Width,form1.Height),mySurface.ClientRect,mySurface,false);
dxdraw1.flip;
end;
procedure TForm1.DXDraw1Initialize(Sender: TObject);
begin
mysurface := TDirectDrawsurface.Create(DXDraw1.ddraw);
mysurface.LoadFromGraphic(DXImagelist1.items.items[0].picture.graphic);
dxtimer1.Enabled:=true;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
mysurface.Free
end;
end.
Bookmarks