VB 图片自由旋转代码

来源:百度知道 编辑:UC知道 时间:2024/05/27 14:01:50
但是我想要的是那个可以达到photoshop那样翻转的效果哦,跟着鼠标旋转,只知道必须建立一个弧度以及用mousemove做,该怎么样呢?

以下方法,慢!
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 HuDu As Double
' JiaoDu角 度
HuDu = JiaoDu * Pi / 180 ' 弧 度
PicSource.ScaleMode = vbPixels
PicTarget.ScaleMode = vbPixels
For x = 0 To PicTarget.ScaleWidth
X1 = x - PicTarget.ScaleWidth \ 2
For y = 0 To PicTarget.ScaleHeight
Y1 = y - PicTarget.ScaleHeight \ 2
X2 = X1 * Cos(-HuDu) + Y1 * Sin(-HuDu)
Y2 = Y1 * Cos(-HuDu) - X1 * Sin(-HuDu)
X3 = X2 + PicSource.ScaleWidth \ 2
Y3 = Y2 + PicSource.ScaleHeight \ 2
If X3 > 0 And X3 < PicSource.ScaleWidth - 1 And Y3 > 0 And Y3 < PicSource.ScaleHeight - 1 Then
PicTarget.PSet (x, y), PicSource.Point(X3, Y3)
End If
Next y
Next x

仅供参考:

启动vb6建立一个标准exe工程,首先添加两个图片框(picture1和picture2),添加三个命令按钮command1(caption=“正常显示”)、command2(capti