Ver Mensaje Individual
  #6  
Antiguo 27-06-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola RSC9421.

No veo la dificultad en borrar y dibujar una linea ante la presión de una tecla como por ejemplo hago en este código:
Código Delphi [-]
...
implementation

const
  INCR = PI / 15;

var
  Center: TPoint;
  Posic : TPoint;
  Radio : Integer;
  Cont  : Single;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Canvas.Pen.Style:= psSolid;
  Canvas.Pen.Color:= clBlack;
  Center:= Point(Width div 2, Height div 2);
  Posic:= Point(0, 0);
  Radio:= 100;
  Cont:= PI;
  KeyPreview:= True;
end;

procedure DrawLine(CV: TCanvas; const Ini,Fin: TPoint; const aColor: TColor);
begin
  CV.Pen.Color:= aColor;
  CV.MoveTo(Ini.X,Ini.Y);
  CV.LineTo(Fin.X, Fin.Y);
  CV.Ellipse(Fin.X-5,Fin.Y-5,Fin.X+5,Fin.Y+5);
end;

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  DrawLine(Canvas, Center, Posic, clBtnFace);
  Posic.X:= Center.X + Trunc(Radio * sin(Cont));
  Posic.Y:= Center.Y + Trunc(Radio * cos(Cont));
  DrawLine(Canvas, Center, Posic, clBlack);
  if Key = VK_RIGHT then
    Cont:= Cont - INCR
  else if Key = VK_LEFT then
    Cont:= Cont + INCR;
end;
...

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 30-06-2014 a las 16:06:36.
Responder Con Cita