vb图片翻转代码。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vb图片翻转代码。相关的知识,希望对你有一定的参考价值。

试试这个:Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Const srcopy = &HCC0020
Private Sub Form_Load()
Picture2.Picture = LoadPicture(App.Path & "\\a01.bmp") \'导入图片
h = Picture1.Height
w = Picture1.Width
End Sub
Private Sub Command1_Click() \'旋转180度
Picture2.Picture = LoadPicture("")
For j = 0 To h Step 1
For i = 0 To w Step 1
BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - i, h - j, srcopy
Next i
Next j
End SubPrivate Sub Command2_Click() \'顺时针旋转90度
Picture2.Picture = LoadPicture("")
For i = h To 0 Step -1
For j = 0 To w Step 1
BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - j, h - i, srcopy
Next j
Next i
End Sub
Private Sub Command3_Click() \'逆时针旋转90度
Picture2.Picture = LoadPicture("")
For j = w To 0 Step -1
For i = 0 To h Step 1
BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, j, i, srcopy
Next i
Next j
End SubPrivate Sub Command4_Click() \'水平翻转
Picture2.Picture = LoadPicture("")
For i = w To 0 Step -1
For j = 0 To h Step 1
BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, i, j, srcopy
Next j
Next i
End SubPrivate Sub Command5_Click() \'垂直翻转
Picture2.Picture = LoadPicture("")
For j = 0 To h Step 1
For i = 0 To w Step 1
BitBlt Picture2.hDC, i, j, 1, 1, Picture1.hDC, w - i, h - j, srcopy
Next i
Next j
End Sub
参考技术A 用PaintPicture方法一句代码即可搞定,比如把Picture1的图片水平翻转后在Picture2中显示出来:Picture2.PaintPicture Picture1.Picture, 0, 0, Picture1.Width, Picture1.Height, Picture1.Width, 0, -Picture1.Width, Picture1.Height 参考技术B 其实,vb自带有一个函数,paintpicture,和bitblt差不多!具体在msdn帮助里有例子!

vb代码之-------翻转标题栏

入吾QQ群183435019(学习 交流+唠嗑)

程序结构运行如下

技术分享图片

 

代码

Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE As Long = -16
Private Const GWL_EXSTYLE As Long = -20

Private Sub Form_Load()
Dim Rut As Long
Rut = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong hwnd, GWL_EXSTYLE, Rut Or &H8000

End Sub

 







以上是关于vb图片翻转代码。的主要内容,如果未能解决你的问题,请参考以下文章

怎样用CSS实现图片翻转

CSS3翻转图片问题

android 上下滑动按钮 按钮图片翻转180度从正面到反面 再滑动回到正面 如此循环 就代码 先谢谢了

Unity 使用C#翻转图片并缩放

css3 如何让一个图片不断翻转

vb 如何放大或缩小图片,用Picture控件