在Form_load中加载,运行后不能在控件数组中显示图片,
我把Form_load中的代码放在Form_click 中,运行点击窗体后却可以得到相应的结果请大家帮忙下~谢谢
Option ExplicitPrivate Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As LongPrivate Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As LongPrivate Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As LongPrivate Sub Form_Load()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim p As Long
Dim getThefile As String
Dim i As Integer
i = 1
'使用数据源来连接数据库
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.path & "\menu.mdb" + ";Persist Security Info=False"
rs.Open "select * from menu", conn '显示结果
rs.MoveFirst
While (Not rs.EOF)
getThefile = rs.Fields(3)
If ExtractIcon(App.hInstance, getThefile, -1) = 0 Then
GoTo MyErr
Else
p = ExtractIcon(App.hInstance, getThefile, 0)
DrawIcon Picture1(i).hdc, 0, 0, p
End If i = i + 1
rs.MoveNext
Wend
MyErr:
MsgBox "No Icon"
End Sub
我把Form_load中的代码放在Form_click 中,运行点击窗体后却可以得到相应的结果请大家帮忙下~谢谢
Option ExplicitPrivate Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As LongPrivate Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As LongPrivate Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As LongPrivate Sub Form_Load()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim p As Long
Dim getThefile As String
Dim i As Integer
i = 1
'使用数据源来连接数据库
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.path & "\menu.mdb" + ";Persist Security Info=False"
rs.Open "select * from menu", conn '显示结果
rs.MoveFirst
While (Not rs.EOF)
getThefile = rs.Fields(3)
If ExtractIcon(App.hInstance, getThefile, -1) = 0 Then
GoTo MyErr
Else
p = ExtractIcon(App.hInstance, getThefile, 0)
DrawIcon Picture1(i).hdc, 0, 0, p
End If i = i + 1
rs.MoveNext
Wend
MyErr:
MsgBox "No Icon"
End Sub
解决方案 »
- 哪位大哥能帮我用VB写出 这道机械原理题目啊
- 动态网页数据
- 急求 如何用vb实现物理实验仿真?
- 请问扩展名为*.UZY的文件是做什么用的,直接删除掉,对源程序会有影响吗
- 请问如何得到一个字符串的字节数
- UMLChina训练教材-《有效用例模式》上市
- 怎样设置VB调试时的PATH
- 什么是b/s结构的软件
- 在MSCHART中如何实现一边显示刻度值,一边显示百分比,在线等待
- 高手来拿分,我想做上网计费软件,能不能给点思路,或者原程序
- VB中如何调用Delphi编写的DLL?
- 一个项目组由多个项目组成,组成一个项目组.可是打包时只能对某一个项目打包呀.可是我的完整程序是由多个项目组成的呀?能对一个项目组打包
实在不行就设置一个timer,在窗体完全显示后再画出来