Private Sub Command1_Click() Dim x As Long Dim y As Long Dim xDest As Long Dim yDest As Long Dim xSrc As Long Dim ySrc As Long Dim nAngle As Long Picture1.ScaleMode = vbPixels Picture2.ScaleMode = vbPixels nAngle = CLng(Text1.Text) nAngle = (720 - (nAngle - 90)) Mod 360 For y = 0 To Picture2.ScaleHeight For x = 0 To Picture2.ScaleWidth xDest = x - Picture2.ScaleWidth / 2# yDest = y - Picture2.ScaleHeight / 2# xSrc = Sin(nAngle * PI / 180#) * xDest + Cos(nAngle * PI / 180#) * yDest ySrc = -(Cos(nAngle * PI / 180#) * xDest - Sin(nAngle * PI / 180#) * yDest) xSrc = xSrc + Picture1.ScaleWidth / 2# ySrc = ySrc + Picture1.ScaleHeight / 2# Picture2.PSet (x, y), Picture1.Point(xSrc, ySrc) Next Next End Sub |