| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 284 人关注过本帖
标题:图片旋转
只看楼主 加入收藏
keker
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2007-11-3
收藏
 问题点数:0 回复次数:2 
图片旋转

‘在窗体上加两个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
一水先生
Rank: 1
等 级:新手上路
帖 子:35
专家分:0
注 册:2007-11-5
收藏
得分:0 

呵呵

2007-11-05 22:54
kr_zHaYj
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2007-10-31
收藏
得分:0 
呵呵  ,很好
2007-11-06 07:53
快速回复:图片旋转
数据加载中...
 
   



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

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