Ver Mensaje Individual
  #93  
Antiguo 12-08-2007
Avatar de ArdiIIa
[ArdiIIa] ArdiIIa is offline
Miembro Premium
 
Registrado: nov 2003
Ubicación: Valencia city
Posts: 1.481
Reputación: 22
ArdiIIa Va por buen camino
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
    { Private declarations }
  public
    { Public declarations }
  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 ;//div 2;
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
__________________
Un poco de tu generosidad puede salvar la vida a un niño. ASÍ DE SENCILLO
Responder Con Cita