📄 form4.frm
字号:
VERSION 5.00
Begin VB.Form frmPicSize
BorderStyle = 1 'Fixed Single
Caption = "图片属性设置"
ClientHeight = 3090
ClientLeft = 3405
ClientTop = 3270
ClientWidth = 3675
Icon = "Form4.frx":0000
LinkTopic = "Form4"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 3675
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2250
TabIndex = 8
Top = 2535
Width = 1185
End
Begin VB.CommandButton Command1
Caption = "确定"
Default = -1 'True
Height = 375
Left = 810
TabIndex = 7
Top = 2535
Width = 1185
End
Begin VB.Frame Frame1
Caption = "图片大小"
Height = 2280
Left = 90
TabIndex = 0
Top = 90
Width = 3525
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 315
Left = 1485
TabIndex = 4
Text = " 768"
Top = 1635
Width = 1200
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 315
Left = 1485
TabIndex = 3
Text = " 1024"
Top = 1215
Width = 1200
End
Begin VB.OptionButton Option2
Caption = "按指定大小"
Height = 270
Left = 615
TabIndex = 2
Top = 870
Width = 1785
End
Begin VB.OptionButton Option1
Caption = "按窗口大小"
Height = 255
Left = 615
TabIndex = 1
Top = 480
Value = -1 'True
Width = 1935
End
Begin VB.Label Label2
Caption = "高度:"
Enabled = 0 'False
Height = 195
Left = 960
TabIndex = 6
Top = 1710
Width = 600
End
Begin VB.Label Label1
Caption = "宽度:"
Enabled = 0 'False
Height = 195
Left = 975
TabIndex = 5
Top = 1305
Width = 600
End
End
End
Attribute VB_Name = "frmPicSize"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public f4picw, f4pich As Long '保存设置的图片尺寸
Private Sub Command1_Click()
'保存设置的图片大小
On Error GoTo aaa:
f4picw = Val(Me.Text1.Text)
f4pich = Val(Me.Text2.Text)
'Unload Me
Me.Hide
Exit Sub
aaa:
f4picw = 1024
f4pich = 768
Me.Text1.Text = f4picw
Me.Text2.Text = f4pich
MsgBox " 图片尺寸大小错误 ! ", vbOKOnly, " 错误"
End Sub
Private Sub Command2_Click()
'取消
Me.Text1.Text = f4picw
Me.Text2.Text = f4pich
'Unload Me
Me.Hide
End Sub
Private Sub Form_Load()
On Error GoTo aaa:
f4picw = Val(Me.Text1.Text)
f4pich = Val(Me.Text2.Text)
Exit Sub
aaa:
f4picw = 1024
f4pich = 768
End Sub
Private Sub Option1_Click()
Me.Label1.Enabled = False
Me.Label2.Enabled = False
Me.Text1.Enabled = False
Me.Text2.Enabled = False
End Sub
Private Sub Option2_Click()
Me.Label1.Enabled = True
Me.Label2.Enabled = True
Me.Text1.Enabled = True
Me.Text2.Enabled = True
End Sub
Private Sub Text1_GotFocus()
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
Private Sub Text2_GotFocus()
Me.Text2.SelStart = 0
Me.Text2.SelLength = Len(Me.Text2.Text)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
'=======================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -