【VB开源代码栏目提醒】:网学会员--在 VB开源代码编辑为广大网友搜集整理了:FileDialog.Frm绩等信息,祝愿广大网友取得需要的信息,参考学习。
VERSION 5.00
Begin VB.Form FileDialog
BorderStyle = 1 'Fixed Single
Caption = "利用API函数实现打开对话框"
ClientHeight = 1605
ClientLeft = 3435
ClientTop = 4710
ClientWidth = 3120
Icon = "File Dialog.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 1605
ScaleWidth = 3120
Begin VB.TextBox Filename
Height = 285
Left = 120
TabIndex = 3
TabStop = 0 'False
Top = 480
Width = 2415
End
Begin VB.CommandButton Cancel
Caption = "取消[&C]"
Height = 375
Left = 1680
TabIndex = 1
Top = 1080
Width = 975
End
Begin VB.CommandButton FileOpen
Caption = "打开文件[&F]"
Default = -1 'True
Height = 375
Left = 120
TabIndex = 0
Top = 1080
Width = 1335
End
Begin
VB.Label Filenamelabel
Caption = "打开的文件名"
Height = 255
Left = 240
TabIndex = 2
Top = 120
Width = 1695
End
End
Attribute VB_Name = "FileDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cancel_Click()
Unload Me
End Sub
Private Sub FileOpen_Click()
Dim ofn As OPENFILENAME
Dim rtn As String
ofn.lStructSize = Len(ofn)
ofn.hwndOwner = Me.hWnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = "所有文件"
ofn.lpstrFile = Space(254)
ofn.nMaxFile = 255
ofn.lpstrFileTitle = Space(254)
ofn.nMaxFileTitle = 255
ofn.lpstrInitialDir = App.Path
ofn.lpstrTitle = "打开文件"
ofn.flags = 6148
rtn = GetOpenFileName(ofn)
If rtn >= 1 Then
Filename.Text = ofn.lpstrFile
Else
Filename.Text = "Cancel Was Pressed"
End If
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
End Sub