Private Sub Command1_Click()
    Const Pi = 3.1415926
    Dim x As Integer, y As Integer
    Dim X1 As Integer, Y1 As Integer
    Dim X2 As Double, Y2 As Double
    Dim X3 As Double, Y3 As Double
    Dim Angle As Integer
    Dim HuDu As Single
    Dim Pcolor As Long
    '清除图片框Picture2
    Picture2.Cls
    '获得用户输入的角度
    Angle = Val(Text1.Text)
    '将角度转换为弧度
    HuDu = Angle * Pi / 180
    '设置图片框的度量单位为象素
    Picture1.ScaleMode = vbPixels
    Picture2.ScaleMode = vbPixels
    '逐点旋转象素,并逐点复制
    For x = 0 To Picture2.ScaleWidth
        X1 = x - Picture2.ScaleWidth \ 2
        For y = 0 To Picture2.ScaleHeight
            Y1 = y - Picture2.ScaleHeight \ 2
            '旋转象素点
            X2 = X1 * Cos(-HuDu) + Y1 * Sin(-HuDu)
            Y2 = Y1 * Cos(-HuDu) - X1 * Sin(-HuDu)
            X3 = X2 + Picture1.ScaleWidth \ 2
            Y3 = Y2 + Picture1.ScaleHeight \ 2
            '如果象素点在待旋转位图内
            If X3 > 0 And X3 < Picture1.ScaleWidth - 1 Then
                If Y3 > 0 And Y3 < Picture1.ScaleHeight - 1 Then
            '逐点复制位图
            Pcolor = Picture1.Point(X3, Y3)
            Picture2.PSet (x, y), Pcolor
                End If
            End If
        Next y
    Next x
End Sub



											
	    

	
											

