by Jim the best (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 7th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Rotate a picture through any angle.
API Declarations
'Set the DrawWidth two 2 or 3 to avoid gaps.
Private Sub Command1_Click()
Picture2.Cls
For x = 1 To Picture1.ScaleWidth
For y = 1 To Picture1.ScaleHeight
R = Sqr(x ^ 2 + y ^ 2)
Angle = Atn(y / x)
New_Angle = Angle + (Text1.Text * Pi / 180)
New_x = R * Cos(New_Angle)
new_y = R * Sin(New_Angle)
Picture2.PSet (Picture2.ScaleWidth / 2 + New_x, Picture2.ScaleHeight / 2 + new_y), Picture1.Point(x, y)
Next y
Next x
End Sub
Private Sub Form_Load()
Text1.Text = 0
Command1.Value = True
End Sub