📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "图像的旋转"
ClientHeight = 4455
ClientLeft = 60
ClientTop = 345
ClientWidth = 6480
LinkTopic = "Form1"
ScaleHeight = 297
ScaleMode = 3 'Pixel
ScaleWidth = 432
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command7
Caption = "退出"
Height = 480
Left = 4905
TabIndex = 8
Top = 3915
Width = 1395
End
Begin VB.CommandButton Command6
Caption = "复位"
Height = 480
Left = 4905
TabIndex = 7
Top = 3285
Width = 1395
End
Begin VB.CommandButton Command5
Caption = "垂直翻转"
Height = 480
Left = 4905
TabIndex = 6
Top = 2655
Width = 1395
End
Begin VB.CommandButton Command4
Caption = "水平翻转"
Height = 480
Left = 4905
TabIndex = 5
Top = 1995
Width = 1395
End
Begin VB.CommandButton Command3
Caption = "90度(逆时针)"
Height = 480
Left = 4905
TabIndex = 4
Top = 1350
Width = 1395
End
Begin VB.CommandButton Command2
Caption = "90度(顺时针)"
Height = 480
Left = 4905
TabIndex = 3
Top = 705
Width = 1395
End
Begin VB.PictureBox Picture2
AutoSize = -1 'True
Height = 3345
Left = 150
ScaleHeight = 219
ScaleMode = 3 'Pixel
ScaleWidth = 298
TabIndex = 2
Top = 480
Width = 4530
End
Begin VB.CommandButton Command1
Caption = "180度"
Height = 480
Left = 4905
TabIndex = 1
Top = 60
Width = 1395
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 3345
Left = 180
Picture = "Form1.frx":0000
ScaleHeight = 3285
ScaleWidth = 4470
TabIndex = 0
Top = 405
Visible = 0 'False
Width = 4530
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'函数声明
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
Dim h As Integer
Dim w As Integer
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 Sub
Private 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 Sub
Private 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 Sub
Private 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
Private Sub Command6_Click() '复位
Picture2.Picture = LoadPicture("")
For i = 0 To w 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 Sub
Private Sub Command7_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -