我的目的是:点击picture控件,并且显示选中的图片文件。
问题是:在picture控件位置上显示图片的同时,系统本身也会打开此图片文件,并且夺取焦点,这个问题怎么解决??
'打开图片数据库
Private Function OpenPicDatabase() As String
' Dim Dgg As Object
Set Dgg = CreateObject("MSComDlg.CommonDialog")
Dgg.CancelError = True
Dgg.Filter = "JPG文件(*.JPG)|*.JPG|JPEG文件(*.JPEG)|*.JPEG"
On Error GoTo CancelOperation
Dgg.ShowOpen
ShellExecute Me.hwnd, "open", Dgg.FileName, "", App.Path, SW_SHOW
CancelOperation:End Function
Private Sub picAddZDInfo_Click()
OpenPicDatabase
picAddZDInfo.Picture = LoadPicture(Dgg.FileName)End Sub
问题是:在picture控件位置上显示图片的同时,系统本身也会打开此图片文件,并且夺取焦点,这个问题怎么解决??
'打开图片数据库
Private Function OpenPicDatabase() As String
' Dim Dgg As Object
Set Dgg = CreateObject("MSComDlg.CommonDialog")
Dgg.CancelError = True
Dgg.Filter = "JPG文件(*.JPG)|*.JPG|JPEG文件(*.JPEG)|*.JPEG"
On Error GoTo CancelOperation
Dgg.ShowOpen
ShellExecute Me.hwnd, "open", Dgg.FileName, "", App.Path, SW_SHOW
CancelOperation:End Function
Private Sub picAddZDInfo_Click()
OpenPicDatabase
picAddZDInfo.Picture = LoadPicture(Dgg.FileName)End Sub
去掉这一句:ShellExecute Me.hwnd, "open", Dgg.FileName, "", App.Path, SW_SHOW
' Dim Dgg As Object
Set Dgg = CreateObject("MSComDlg.CommonDialog")
Dgg.CancelError = True
Dgg.Filter = "JPG文件(*.JPG)|*.JPG|JPEG文件(*.JPEG)|*.JPEG"
On Error GoTo CancelOperation
Dgg.ShowOpen
CancelOperation:End FunctionPrivate Sub picAddZDInfo_Click()
OpenPicDatabase
picAddZDInfo.Picture = LoadPicture(Dgg.FileName)End Sub