form1.frm
来自「VB源码,是初学者的福因.让你很快掌握VB编程」· FRM 代码 · 共 66 行
FRM
66 行
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 + =
减小字号Ctrl + -
显示快捷键?