标题:图片旋转
取消只看楼主
keker
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-11-3
 问题点数:0 回复次数:0 
图片旋转

‘在窗体上加两个picturebox控件,五个option控件放在frame框架上,一个按钮

Option Explicit
Const Pi = 3.1416
Dim JiaoDu As Double
Function b(i)
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
JiaoDu = Option1(i).Caption

Picture2.Visible = True
Picture2.Cls

Dim Hudu As Double
Hudu = JiaoDu * 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 And Y3 > 0 And Y3 < Picture1.ScaleHeight - 1 Then
Picture2.PSet (x, y), Picture1.Point(X3, Y3)
End If
Next y
Next x

Picture1.Visible = False
End Function


Private Sub Command1_Click()
Dim i As Single
If Option1(0).Value = True Then
Shape1.Visible = False

Call b(0)
ElseIf Option1(1).Value = True Then

Shape1.Visible = False
Call b(1)
ElseIf Option1(2).Value = True Then
Shape1.Visible = False

Call b(2)
ElseIf Option1(3).Value = True Then
Shape1.Visible = False
Call b(3)
Else
Shape1.Visible = True
Picture2.Cls
End If

End Sub

Private Sub Form_Load()
Picture2.Visible = True
Picture1.Visible = False

Shape1.Visible = True
End Sub

Private Sub Frame1_Click() ‘单击框架恢复
Shape1.Visible = True
Picture2.Cls
End Sub

搜索更多相关主题的帖子: 图片 旋转 frame option 
2007-11-03 22:47



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-183269-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027795 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved