1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub Rotation(ByVal AngleDegre As Integer)
Dim G As Graphics
Dim Largeur As Integer = 300
Dim Hauteur As Integer = 296
Dim IMG = PictureBox1.Image
G = PictureBox1.CreateGraphics()
G.Clear(Me.BackColor)
Dim Angle As Double = AngleDegre / 180 * Math.PI
Dim PosX As Single = Math.Sqrt(2) * (Largeur) * Math.Sin(Angle / 2) * Math.Cos(Math.PI / 4 + Angle / 2)
Dim PosY As Single = -Math.Sqrt(2) * (Largeur) * Math.Sin(Angle / 2) * Math.Cos(Math.PI / 4 - Angle / 2)
G.RotateTransform(AngleDegre)
G.DrawImage(IMG, PosX, PosY, Largeur, Hauteur)
G.Dispose()
End Sub |