盘符与文件夹与文件名的图标用API都解决了,树根是“我的电脑”这个系统
小图标怎样取到呢?       + 我的电脑
           + A:
           + C:
                +Windows
           + D:
           + E
可执行一下资源管理器,看看“我的电脑”的图标形状,这是系统图标。

解决方案 »

  1.   

    我想问一下你用什么API取的文件的图标啊
    谢谢 
    发到我的信箱里
      

  2.   

    没找到API方法前,我建议你取个“我的电脑”的真彩图标,explorer.exe内就有,
    并把你这个图标当作你程序的图标,TreeView的顶层“我的电脑”就用
    你程序(Application->ExeName)的图标当作图标!
      

  3.   

    procedure TFolderImage.DoLoadImageThumbnail(AFileName:String;var ABitmap:TBitmap);
    var
      Icon:TIcon;
      shinfo:SHFileInfo;
      OriSize,NewSize:TSize;
      Rect:TRect;
      FolderTmp:String;
    begin
      FolderTmp:=AFileName;
      if (ExtractFileName(FolderTmp)='..') then begin
        FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp)-1);
        FolderTmp:=Copy(FolderTmp,1,LastDelimiter('\',FolderTmp));
      end;
      Icon:=TIcon.Create();
      try
        if SHGetFileInfo(pchar(FolderTmp),0,shinfo,sizeof(shinfo),SHGFI_ICON)=0 then begin
          raise Exception.Create('TFolderImage: Error when load folder''s icon');
        end;
        Icon.Handle:=shinfo.hIcon;
        Icon.Transparent:=false;
        OriSize.cx:=Icon.Width;
        OriSize.cy:=Icon.Height;
        NewSize:=GetThumbnailSize(OriSize);
        ABitmap.Width:=NewSize.cx;
        ABitmap.Height:=NewSize.cy;
        Rect.Left:=0;
        Rect.Top:=0;
        Rect.Right:=NewSize.cx;
        Rect.Bottom:=NewSize.cy;
        ABitmap.Canvas.Brush.Color:=clBtnFace;
        ABitmap.Canvas.FillRect(Rect);
        ABitmap.Canvas.StretchDraw(Rect,Icon);
      finally
        Icon.Free;
      end;
    end;这段程序是取某个文件夹的图标用的,桌面的话,它的对应路径其实应该是:
    C:\Documents and Settings\Administrator\Desktop
      

  4.   

    嗬嗬,有这么一个DLL,那就是在WINNT\system32\shell32.dll,图标就在里面。我这个是笨笨的办法啊,LoadLibrary它吧。或者去下载一个图表库,网络上很多的哦。
      

  5.   

    是用ImageList,句柄是系统的,问题是:“我的电脑”图标怎样从这个
    ImageList1中取到ImageIndex呀
      

  6.   

    用BCB的方法可以,但不是最佳方法