1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Public Sub tournons(forma As Form, _
CentreX As Single, _
CentreY As Single, _
Longueur As Integer, _
Largeur As Integer, _
Epaisseur, _
Coultrait, _
Plein)
Dim Centre As Point
Dim PtOrg1 As Point, PtOrg2 As Point, PtOrg3 As Point, PtOrg4 As Point
Dim PtDest1 As Point, PtDest2 As Point, PtDest3 As Point, PtDest4 As Point
Dim Angle As Long
Angle = CLng(AngleRot)
Centre.X = CentreX
Centre.Y = CentreY
PtOrg1.X = Centre.X - Longueur / 2: PtOrg1.Y = Centre.Y - Largeur / 2
PtDest1 = RotatePoint(Angle, Centre, PtOrg1)
PtOrg2.X = PtOrg1.X + Longueur: PtOrg2.Y = PtOrg1.Y
PtDest2 = RotatePoint(Angle, Centre, PtOrg2)
PtOrg3.X = PtOrg2.X: PtOrg3.Y = PtOrg1.Y + Largeur
PtDest3 = RotatePoint(Angle, Centre, PtOrg3)
PtOrg4.X = PtOrg1.X: PtOrg4.Y = PtOrg3.Y
PtDest4 = RotatePoint(Angle, Centre, PtOrg4)
forma.DrawWidth = Epaisseur
forma.ForeColor = Coultrait
' nous pouvons maintenant dessiner les 4 segments qui sont les côtés du rectangle
forma.Line (PtDest1.X, PtDest1.Y)-(PtDest2.X, PtDest2.Y)
forma.Line (PtDest2.X, PtDest2.Y)-(PtDest3.X, PtDest3.Y)
forma.Line (PtDest3.X, PtDest3.Y)-(PtDest4.X, PtDest4.Y)
forma.Line (PtDest4.X, PtDest4.Y)-(PtDest1.X, PtDest1.Y)
End Sub |
Partager