HACER GIRAR UN CUADRADO A PARTIR DEL PLANO CARTESIANO
Este es el código Fuente, trata de crear un plano cartesiano y a partir de el cuando se oprima en el menu la opcion cuadrado, este lo dibula en el plao cartesiano. Ahora necesita que este gire y a medida que vaya girando vaya cambiando de color.
Agradezco a quien me pueda colaborar.
Dim x(4) As Double
Dim y(4) As Double
Sub cuadrado(ap As Integer, ai As Integer)
x(0) = ap * Cos(ai * 3.141598 / 180)
y(0) = ap * Sin(ai * 3.141598 / 180)
x(1) = ap * Cos((ai + 90) * 3.141598 / 180)
y(1) = ap * Sin((ai + 90) * 3.141598 / 180)
x(2) = ap * Cos((ai + 180) * 3.141598 / 180)
y(2) = ap * Sin((ai + 180) * 3.141598 / 180)
x(3) = ap * Cos((ai + 270) * 3.141598 / 180)
y(3) = ap * Sin((ai + 270) * 3.141598 / 180)
pbfig.Line (x(0), y(0))-(x(1), y(1))
pbfig.Line (x(1), y(1))-(x(2), y(2))
pbfig.Line (x(2), y(2))-(x(3), y(3))
pbfig.Line (x(3), y(3))-(x(0), y(0))
End Sub
Private Sub Form_Resize()
pbfig.Left = 500
'pbfig.Width = Me.ScaleWidth - 1000
pbfig.Top = 1000
'pbfig.Height = pbfig.Width / 2
pbfig.Cls
pbfig.Scale (-2000, 2000)-(2000, -2000)
pbfig.Line (-2000, 0)-(2000, 0)
pbfig.Line (0, 2000)-(0, -2000)
'pbfig.Height = Me.ScaleHeight - pbfig.Top - 500
'pbfig.Width = pbfig.Height / 2
End Sub
Private Sub mncua_Click()
If (mntri.Checked = True) Then
mntri.Checked = False
Else
mntri.Checked = True
Call cuadrado(500, 45)
End If
End Sub
Agradezco a quien me pueda colaborar.
Dim x(4) As Double
Dim y(4) As Double
Sub cuadrado(ap As Integer, ai As Integer)
x(0) = ap * Cos(ai * 3.141598 / 180)
y(0) = ap * Sin(ai * 3.141598 / 180)
x(1) = ap * Cos((ai + 90) * 3.141598 / 180)
y(1) = ap * Sin((ai + 90) * 3.141598 / 180)
x(2) = ap * Cos((ai + 180) * 3.141598 / 180)
y(2) = ap * Sin((ai + 180) * 3.141598 / 180)
x(3) = ap * Cos((ai + 270) * 3.141598 / 180)
y(3) = ap * Sin((ai + 270) * 3.141598 / 180)
pbfig.Line (x(0), y(0))-(x(1), y(1))
pbfig.Line (x(1), y(1))-(x(2), y(2))
pbfig.Line (x(2), y(2))-(x(3), y(3))
pbfig.Line (x(3), y(3))-(x(0), y(0))
End Sub
Private Sub Form_Resize()
pbfig.Left = 500
'pbfig.Width = Me.ScaleWidth - 1000
pbfig.Top = 1000
'pbfig.Height = pbfig.Width / 2
pbfig.Cls
pbfig.Scale (-2000, 2000)-(2000, -2000)
pbfig.Line (-2000, 0)-(2000, 0)
pbfig.Line (0, 2000)-(0, -2000)
'pbfig.Height = Me.ScaleHeight - pbfig.Top - 500
'pbfig.Width = pbfig.Height / 2
End Sub
Private Sub mncua_Click()
If (mntri.Checked = True) Then
mntri.Checked = False
Else
mntri.Checked = True
Call cuadrado(500, 45)
End If
End Sub
