📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "图像大小、图像格式的批量转换"
ClientHeight = 4470
ClientLeft = 60
ClientTop = 345
ClientWidth = 10230
LinkTopic = "Form1"
ScaleHeight = 4470
ScaleWidth = 10230
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text4
Height = 345
Left = 7950
TabIndex = 8
Text = "2"
Top = 2790
Width = 1800
End
Begin VB.FileListBox File1
Height = 1530
Left = 630
Pattern = "*.bmp;*.jpg"
TabIndex = 6
Top = 465
Visible = 0 'False
Width = 4470
End
Begin VB.TextBox Text3
Height = 360
Left = 5700
TabIndex = 5
Text = "Text2"
Top = 105
Width = 4455
End
Begin VB.TextBox Text2
Height = 360
Left = 630
TabIndex = 4
Text = "Text2"
Top = 105
Width = 4455
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 450
Left = 7935
TabIndex = 3
Top = 3285
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 450
Left = 7935
TabIndex = 2
Top = 3900
Width = 1815
End
Begin VB.PictureBox Picture2
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1725
Left = -510
ScaleHeight = 1665
ScaleWidth = 1725
TabIndex = 1
Top = 2085
Visible = 0 'False
Width = 1785
End
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 3780
Left = 30
Picture = "Form1.frx":0000
ScaleHeight = 3720
ScaleWidth = 7515
TabIndex = 0
Top = 585
Width = 7575
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "新路径"
Height = 195
Left = 5145
TabIndex = 10
Top = 210
Width = 675
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "原路径"
Height = 195
Left = 45
TabIndex = 9
Top = 210
Width = 675
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "缩小比例"
Height = 225
Left = 8400
TabIndex = 7
Top = 2520
Width = 780
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim res As Integer
Private Sub Form_Load()
Text2.Text = App.Path & "\原图片\"
Text3.Text = App.Path & "\转换后图片\"
res = 500
End Sub
Private Sub Text2_Change()
On Error Resume Next
File1.Path = Text2.Text
End Sub
Private Sub Text2_GotFocus()
File1.Visible = True
End Sub
Private Sub Text2_LostFocus()
File1.Visible = False
End Sub
Private Sub Command1_Click()
Dim i, j, w, h, w1, h1, k As Integer
For k = 0 To File1.ListCount - 1
File1.ListIndex = k
Picture1.Picture = LoadPicture(Text2.Text & "\" & File1.FileName)
w = Picture1.Width / Val(Text4.Text)
h = Picture1.Height / Val(Text4.Text)
w1 = w / 15
h1 = h / 15
Picture2.Width = w
Picture2.Height = h
Picture1.Scale (0, 0)-(w1, h1)
Picture2.Scale (0, 0)-(w1, h1)
For i = 1 To w1
For j = 1 To h1
Picture2.PSet (i, j), Picture1.Point(i, j)
Next j
Next i
Picture2.Picture = Picture2.Image
SavePicture Picture2.Image, Text3.Text & Left(File1.FileName, Len(File1.FileName) - 4) & ".bmp"
Next k
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -