求教:每点击一次按钮图片就顺时针旋转90度,用vb如何写?(要求完整代码,谢谢)
展开全部
在VB中,旋转图片很麻烦的。
使用PSet。
使用PSet。
追问
用 PlgBlt函数是可以做到的,但是我只能把图片旋转90度一次。您可以完整写出来吗?谢谢。
追答
Option Explicit
Const Pi = 3.14
Private Sub Command1_Click()
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 Double
Dim radian As Double
angle = Text1.Text
radian = angle * Pi / 180
Picture2.Cls
For x = 0 To Picture1.Width
For y = 0 To Picture1.Height
X1 = x - Picture1.Width \ 2
Y1 = y - Picture1.Height \ 2
X2 = X1 * Cos(radian) + Y1 * Sin(radian)
Y2 = Y1 * Cos(radian) - X1 * Sin(radian)
X3 = X2 + Picture1.Width \ 2
Y3 = Y2 + Picture1.Height \ 2
If X3 > 0 And X3 0 _
And Y3 < Picture2.Height - 1 Then
Picture2.PSet (X3, Y3), Picture1.Point(x, y)
End If
Next y
Next x
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询