⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 18987.html

📁 VB技巧问答10000例 VB技巧问答10000例
💻 HTML
字号:
<html>  <head>    <title>Re: How to attach the system image list handle to a tree view control ?</title>  </head>  <body bgcolor="#FFFFFF" vlink="#808080">    <center>      <h1>Re: How to attach the system image list handle to a tree view control ?</h1>    </center><hr size=7 width=75%><hr size=7 width=75%><p>Posted by <a href="mailto:haiwenwu@yahoo.com.tw">吴海文</a> on September 16, 1999 at 10:23:15:<p>In Reply to: <a href="18975.html">Re: How to attach the system image list handle to a tree view control ?</a> posted by Sun Jack on September 16, 1999 at 00:01:42:<p>: : 我在VB表单上,放置一个TreeView控制项(名称为treFolder),在程式中使用如下的叙述取得system imagelist handle。<br>: :   himlSmall = SHGetFileInfo("C:\", 0, sfi, Len(sfi), SHGFI_SYSICONINDEX Or SHGFI_SMALLICON)<br>: : 但要如何指定给treFolder.ImageList?<p>: SendMessage hWnd, TVM_SETIMAGELIST, ByVal iImage, ByVal himl<p>谢谢你的解答,但这个方法我己经试过,仍不能正确运作,在执行加入节点时会出现Run-time error '35613' ImageList must be initialized befor it can be used.<br>我的程式码如下:<p>Private Sub Form_Load()<br>   <br>  Dim fSuccess As Boolean   ' flag indicating everything went OK, starts False<br>  Dim himlSmall As Long     ' system imagelist handle<br>  Dim pidlDesktop As Long   ' desktop's pidl, the treeview root<br>  Dim sfi As SHFILEINFO<br>  Dim nodX As Node<br>  Dim sRootName As String<br>  <br>  ' Hourglass on!<br>  Call SetCapture(hWnd)<br>  Call SetCursor(LoadCursor(0, ByVal IDC_WAIT))<p>  ' ===============================================<br>  <br>  ' Grab a handle to the system image list, for our icons<br>  himlSmall = SHGetFileInfo("C:\", 0, sfi, Len(sfi), SHGFI_SYSICONINDEX Or SHGFI_SMALLICON)<br>  <br>  ' ===============================================<br>  <br>  If treFolder.hWnd <> 0 And himlSmall <> 0 Then<br>    'Associate the system image list with the tree view control<br>    Call SendMessage(treFolder.hWnd, TVM_SETIMAGELIST, TVSIL_NORMAL, himlSmall)<br>    treFolder.BorderStyle = vbFixedSingle<br>    treFolder.LineStyle = tvwRootLines<br>    treFolder.Style = tvwTreelinesPlusMinusPictureText<br>  End If<br>    <br>  ' Returns a complex pidl (realtive to the desktop) from a special folder's ID.<br>  Call SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOP, pidlDesktop)<br> <br>  ' Retrieve the root's friendly name (realtive to the desktop) that we'll put in the treeview...<br>  Call SHGetFileInfo(pidlDesktop, 0, sfi, Len(sfi), SHGFI_PIDL Or SHGFI_DISPLAYNAME)<br>  sRootName = sfi.szDisplayName<br>  <br>  Call SHGetFileInfo(pidlDesktop, 0, sfi, Len(sfi), SHGFI_SYSICONINDEX Or SHGFI_SMALLICON Or SHGFI_PIDL)<br>  <br>  Set nodX = treFolder.Nodes.Add(, , , sRootName, sfi.iIcon)<br>  <br>  ' ===============================================<br>    <br>  ' Hourglass off!<br>  Call ReleaseCapture<br>  Call SetCursor(LoadCursor(0, IDC_ARROW))<p>End Sub<p><br><br><hr size=7 width=75%><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 18987--><!--top: 19076--><li><a href="19076.html">Re: How to attach the system image list handle to a tree view control ?</a> <b>Sun Jack</b> <i>00:48:56 9/18/99</i>(<!--responses: 19076-->3)<ul><!--insert: 19076--><!--top: 19155--><li><a href="19155.html">Re: How to attach the system image list handle to a tree view control ?</a> <b>吴海文</b> <i>09:01:21 9/20/99</i>(<!--responses: 19155-->1)<ul><!--insert: 19155--><!--top: 19222--><li><a href="19222.html">Re: How to attach the system image list handle to a tree view control ?</a> <b>Sun Jack</b> <i>23:41:29 9/21/99</i>(<!--responses: 19222-->0)<ul><!--insert: 19222--></ul><!--end: 19222--></ul><!--end: 19155--><!--top: 19154--><li><a href="19154.html">Re: How to attach the system image list handle to a tree view control ?</a> <b>吴海文</b> <i>08:57:41 9/20/99</i>(<!--responses: 19154-->0)<ul><!--insert: 19154--></ul><!--end: 19154--></ul><!--end: 19076--><!--top: 19075--><li><a href="19075.html">Re: How to attach the system image list handle to a tree view control ?</a> <b>Sun Jack</b> <i>00:48:41 9/18/99</i>(<!--responses: 19075-->0)<ul><!--insert: 19075--></ul><!--end: 19075--></ul><!--end: 18987--><br><hr size=7 width=75%><p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -