La propiedad Rotation especifica un número de grados [0..360] para rotar un control en sentido antihorario.
Existen algunas normas a seguir para especificar la rotación en estos controles.
Para los objetos Label, las fuentes deben ser TrueType, la propiedad Style no debe ser igual a 3, la propiedad Alignment solo es respetada cuando Rotation es igual a 0 (cero), la propiedad AutoSize no vuelve a dimensionar el tamaño de la etiqueta.
Para los objetos Shape y Line, la propiedad Rotation solo se aplica a las formas y lineas creadas con la propiedad PolyPoints.
Para mas detalles es recomendable leer la ayuda de la propiedad Rotation.
El siguiente ejemplo crea un formulario con 3 controles que rotan en sentido horario al hacer "click" en el botón "Rotar".

PUBLIC goMiForm
goMiForm=CREATEOBJECT("MiForm")
goMiForm.SHOW(1)
RETURN
DEFINE CLASS MiForm AS FORM
TOP = 0
LEFT = 0
HEIGHT = 480
WIDTH = 380
AUTOCENTER = .T.
DOCREATE = .T.
CAPTION = "Ejemplo de Rotation"
NAME = "MiForm"
ADD OBJECT Shape1 AS SHAPE WITH ;
TOP = 24, ;
LEFT = 24, ;
HEIGHT = 150, ;
WIDTH = 150, ;
BORDERWIDTH = 2, ;
BACKCOLOR = RGB(255,255,0), ;
POLYPOINTS = "This.aPolyPoints", ;
ROTATION = 360, ;
NAME = "Shape1"
ADD OBJECT Line1 AS LINE WITH ;
BORDERWIDTH = 2, ;
HEIGHT = 150, ;
LEFT = 204, ;
TOP = 24, ;
WIDTH = 150, ;
BORDERCOLOR = RGB(255,0,0), ;
POLYPOINTS = "This.aPolyPoints", ;
ROTATION = 360, ;
NAME = "Line1"
ADD OBJECT Label1 AS LABEL WITH ;
FONTNAME = "Arial Black", ;
FONTSIZE = 20, ;
BACKSTYLE = 0, ;
CAPTION = "Comunidad VFP", ;
HEIGHT = 250, ;
LEFT = 24, ;
TOP = 204, ;
WIDTH = 250, ;
FORECOLOR = RGB(0,0,255), ;
ROTATION = 360, ;
NAME = "Label1"
ADD OBJECT cmdRotar AS COMMANDBUTTON WITH ;
TOP = 400, ;
LEFT = 264, ;
HEIGHT = 36, ;
WIDTH = 84, ;
CAPTION = "Rotar", ;
NAME = "cmdRotar"
PROCEDURE Shape1.INIT
WITH THIS
.ADDPROPERTY("aPolyPoints[4,2]")
.aPolyPoints[1,1]= 50
.aPolyPoints[1,2]= 0
.aPolyPoints[2,1]= 100
.aPolyPoints[2,2]= 50
.aPolyPoints[3,1]= 50
.aPolyPoints[3,2]= 100
.aPolyPoints[4,1]= 0
.aPolyPoints[4,2]= 50
ENDWITH
ENDPROC
PROCEDURE Line1.INIT
WITH THIS
.ADDPROPERTY("aPolyPoints[2,2]")
.aPolyPoints[1,1]= 20
.aPolyPoints[1,2]= 20
.aPolyPoints[2,1]= 80
.aPolyPoints[2,2]= 80
ENDWITH
ENDPROC
PROCEDURE cmdRotar.CLICK
*-- Rota en sentido horario
FOR lnI = 350 TO 10 STEP -10
STORE lnI TO ;
THISFORM.Shape1.ROTATION, ;
THISFORM.Line1.ROTATION, ;
THISFORM.Label1.ROTATION
INKEY(.05,"H")
ENDFOR
*-- Retorno a la pocicion inicial
STORE 360 TO ;
THISFORM.Shape1.ROTATION, ;
THISFORM.Line1.ROTATION, ;
THISFORM.Label1.ROTATION
ENDPROC
ENDDEFINE
Luis María Guayán
No hay comentarios. :
Publicar un comentario
Los comentarios son moderados, por lo que pueden demorar varias horas para su publicación.