In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TImage:nZoom

Xailer English public forum
Responder
franksoft
Mensajes: 42
Registrado: Lun Sep 05, 2011 6:45 pm

TImage:nZoom

Mensaje por franksoft »

Hello everyone,
I would like to change the parameter TImage:nZoom using the mouse wheel, someone can give me some suggestions?
Thanks
FRANCO
jlalin
Mensajes: 926
Registrado: Sab Dic 25, 2010 11:10 pm

TImage:nZoom

Mensaje por jlalin »

Franco,
I have not tested it but it should show you the way:
CLASS TImage FROM XImage
PUBLIC:
METHOD WMMouseWheel( nWParam, nLParam )
ENDCLASS
METHOD WMMouseWheel( nWParam, nLParam ) CLASS TImage
LOCAL nDelta := HiWord( nWParam )
LOCAL nSteps := nDelta / 120
::nZoom := nSteps
RETURN 0
Regards,
José Lalí­n
franksoft
Mensajes: 42
Registrado: Lun Sep 05, 2011 6:45 pm

TImage:nZoom

Mensaje por franksoft »

Thanks for the suggestion,
with a small change nZoom parameter changes only if they are inside the image.
CLASS TImage FROM XImage
PUBLIC:
DATA lDentro INIT .F.
METHOD WMMouseWheel( nWParam, nLParam )
RESERVED:
METHOD WMMouseMove( nWParam, nLParam )
METHOD WMMouseLeave( nWParam, nLParam )
ENDCLASS
METHOD WMMouseWheel( nWParam, nLParam ) CLASS TImage
LOCAL nDelta := HiWord( nWParam )
LOCAL nSteps := nDelta / 120
IF ::lDentro
::nZoom += nSteps
ENDIF
RETURN 0
METHOD WMMouseMove( nWParam, nLParam ) CLASS TImage
::lDentro:=.T.
trackmouseevent( ::Handle, TME_LEAVE )
RETURN Nil
METHOD WMMouseLeave( nWParam, nLParam )
::lDentro:=.F.
RETURN Nil
Thanks again
Regards,
FRANCO
Responder