📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1
Caption = "Picture Viewer"
ClientHeight = 2655
ClientLeft = 2355
ClientTop = 2235
ClientWidth = 3150
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2655
ScaleWidth = 3150
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2400
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Image imgShow
Height = 615
Left = 0
Top = 0
Width = 855
End
Begin VB.Menu file
Caption = "文件"
Begin VB.Menu open
Caption = "打开"
End
Begin VB.Menu about
Caption = "关于"
End
Begin VB.Menu exit
Caption = "退出"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub about_Click()
'Displays the form that tells about the program.
frmAbout.Show
End Sub
Private Sub exit_Click()
'Closes the program.
Unload Me
End Sub
Private Sub open_Click()
Dim Whatfile As String ' Defines variables.
CommonDialog1.Filter = "All Files (*.*)|*.*|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif|BMP Files (*.bmp)|*.bmp" 'Sets all of the file filters.
CommonDialog1.ShowOpen 'Opens the "Open" Dialog box.
Whatfile = CommonDialog1.FileName '"Whatfile" is temporary the name of the selected file. The file is stored in memory and can be used by using the word "Whatfile" as I used here.
imgShow.Picture = LoadPicture(Whatfile) 'Puts "Whatfile" (The image) into the imgShow object.
Form1.Height = imgShow.Height + 675 'Adjusts the form's height to fit the picture.
Form1.Width = imgShow.Width + 135 'Adjusts the form's width to fit the picture.
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -