vb在picturebox中实现图片旋转 怎样使旋转后的图片在image中显示出来
展开全部
Option Explicit
Private Sub Command1_Click()
Me.Caption = "正在翻转..."
If PictureInvH(Picture1) = 1 Then
Me.Caption = "翻转完成!"
End If
End Sub
Public Function PictureInvH(pic As PictureBox) As Long
Dim w As Integer, h As Integer
Dim sm As Long, ar As Boolean
Dim i As Long, j As Long
Dim clr As Long
sm = pic.ScaleMode
ar = pic.AutoRedraw
pic.ScaleMode = 3
pic.AutoRedraw = True
w = pic.ScaleWidth - 1
h = pic.ScaleHeight - 1
For j = 0 To h
For i = 0 To (w - (w Mod 2)) / 2
clr = pic.Point(i, j)
'Debug.Print clr
pic.PSet (i, j), pic.Point(w - i, j)
pic.PSet (w - i, j), clr
Next i
Next j
pic.ScaleMode = sm
pic.AutoRedraw = ar
PictureInvH = &H1
End Function
Private Sub Command1_Click()
Me.Caption = "正在翻转..."
If PictureInvH(Picture1) = 1 Then
Me.Caption = "翻转完成!"
End If
End Sub
Public Function PictureInvH(pic As PictureBox) As Long
Dim w As Integer, h As Integer
Dim sm As Long, ar As Boolean
Dim i As Long, j As Long
Dim clr As Long
sm = pic.ScaleMode
ar = pic.AutoRedraw
pic.ScaleMode = 3
pic.AutoRedraw = True
w = pic.ScaleWidth - 1
h = pic.ScaleHeight - 1
For j = 0 To h
For i = 0 To (w - (w Mod 2)) / 2
clr = pic.Point(i, j)
'Debug.Print clr
pic.PSet (i, j), pic.Point(w - i, j)
pic.PSet (w - i, j), clr
Next i
Next j
pic.ScaleMode = sm
pic.AutoRedraw = ar
PictureInvH = &H1
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询