Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 15-03-2008
Avatar de ZayDun
ZayDun ZayDun is offline
Miembro
 
Registrado: mar 2007
Posts: 129
Poder: 18
ZayDun Va por buen camino
Question Moviendo imagenes con el raton

Hola, estoy intentando hacer que una imagen se mueve con el raton, tengo el codigo pero no me termina de convencer ya que la imagen se mueve una vez he soltado el boton del raton, y lo que yo quiero es que la imagen siga al raton hasta que yo lo suelte. aqui dejo el codigo que utilizo por si se le puede agregar algo para mejorarlo o mejor otro metodo. saludos! y gracias.


Código Delphi [-]
procedure TForm1.o10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var OrgFormPoint, CurCursorPoint, OrgCursorPoint: TPoint;
begin
OrgFormPoint.X := o10.Left;
OrgFormPoint.Y := o10.Top;
GetCursorpos(OrgCursorPoint);
While (GetAsyncKeystate(VK_LBUTTON) <> 0) do
begin
GetCursorpos(CurCursorPoint);
o10.Left := OrgFormPoint.X - OrgCursorPoint.X + CurCursorPoint.X;
o10.Top := OrgFormPoint.Y - OrgCursorPoint.Y + CurCursorPoint.Y;
end;
Responder Con Cita
  #2  
Antiguo 15-03-2008
Avatar de ixMike
ixMike ixMike is offline
Miembro
 
Registrado: feb 2004
Posts: 1.151
Poder: 22
ixMike Va por buen camino
Lo que pasa es que no mandas dibujar a la imagen hasta que se suelta:

Código Delphi [-]
procedure TForm1.o10MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
 var OrgFormPoint, CurCursorPoint, OrgCursorPoint: TPoint;
begin
 OrgFormPoint.X := o10.Left; 
 OrgFormPoint.Y := o10.Top;
 GetCursorpos(OrgCursorPoint);
 While (GetAsyncKeystate(VK_LBUTTON) <> 0) do
   begin
   GetCursorpos(CurCursorPoint);
   o10.Left := OrgFormPoint.X - OrgCursorPoint.X + CurCursorPoint.X;
   o10.Top := OrgFormPoint.Y - OrgCursorPoint.Y + CurCursorPoint.Y;
   Repaint; //Te falta esta línea
   end;
end;


Salu2


Edito: En vez de redibujar la imagen, has de redibujar todo el Form, ya que sino queda un "rastro".

Última edición por ixMike fecha: 15-03-2008 a las 20:27:42.
Responder Con Cita
  #3  
Antiguo 15-03-2008
Avatar de ZayDun
ZayDun ZayDun is offline
Miembro
 
Registrado: mar 2007
Posts: 129
Poder: 18
ZayDun Va por buen camino
gracias ixMike por la ayuda, parpadea un poco.. xD pero eso ya es otra cosa, Salu2
Responder Con Cita
  #4  
Antiguo 15-03-2008
Avatar de ixMike
ixMike ixMike is offline
Miembro
 
Registrado: feb 2004
Posts: 1.151
Poder: 22
ixMike Va por buen camino
Si, ya lo imaginaba que parpadearía... sería cuestión de redibujar sólo cuando hubiera movimiento, y no cuando estuviera parado
Responder Con Cita
  #5  
Antiguo 15-03-2008
Avatar de ZayDun
ZayDun ZayDun is offline
Miembro
 
Registrado: mar 2007
Posts: 129
Poder: 18
ZayDun Va por buen camino
ya he solucionado el parpadeo, aqui dejo el codigo.. tan solo tenia que poner la propiedad DoubleBuffered del Form a True.

Código Delphi [-]
Form1.DoubleBuffered := true;
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema con el raton jumper Varios 4 22-02-2008 10:58:46
problema moviendo en el listbox ramphi Varios 2 10-12-2007 23:39:31
Moviendo Shapes (CLX): flickering y Off-screen bitmaps kinobi Gráficos 15 08-08-2007 01:25:22
Moviendo Form GaaK Varios 0 18-11-2006 16:35:43
Moviendo Datos Gabriel2 Firebird e Interbase 1 07-01-2005 07:07:18


La franja horaria es GMT +2. Ahora son las 20:20:31.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi