Oyes, no te voy a dejar con las ganas...
Espero que ahora no se me echen encima los de RENFE
Código Delphi
[-]
unit loquequieras;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormResize(Sender: TObject);
private
public
end;
const
ShapeSize = 40;
var
Form1: TForm1;
rShape : TRect;
Step,XCli, Ycli,XCent, YCent : Integer;
Ps : PaintStruct;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
rShape := GetClientRect;
rShape.Right := XCent + ShapeSize;
rShape.Bottom := YCent + ShapeSize;
rShape.Top := yCent;
rShape.Left := xCent;
xCent := xCent +Step;
If (xCent + ShapeSize >= xCli) or (xCent <=0) then
Step := -Step;
InvalidateRect(Handle,@rShape,True);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Ellipse(Canvas.Handle,5+xCent,29+yCent,15+xCent,39+yCent);
Ellipse(Canvas.Handle,25+xCent,29+yCent,35+xCent,39+yCent);
Rectangle(Canvas.Handle,2+xCent,19+yCent,37+xCent,29+yCent);
Rectangle(Canvas.Handle,17+xCent,0+yCent,23+xCent,19+yCent);
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Step := 2 ;
xCli := ClientRect.Right ;yCLi := ClientRect.Bottom div 2;
Invalidate;
end;
end.
Código:
object Form1: TForm1
Left = 119
Top = 268
Width = 256
Height = 85
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnPaint = FormPaint
OnResize = FormResize
PixelsPerInch = 96
TextHeight = 13
object Timer1: TTimer
Interval = 5
OnTimer = Timer1Timer
Left = 32
Top = 16
end
end