大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> 程序开发 -> 如何在你的程序中使用系统图标

如何在你的程序中使用系统图标

时间: 2021-07-31 作者:daque

在资源处置器中,每一个目次文献都有自已的图标,怎样在自已的运用步调里运用它呢?底下给出关系的例程,以及大略的挪用范例。uses shellapi;第一步  博得体例的图标列表的句柄,将之付与一个图像列表控件。procedure getsystemimagelist(imagelist:timagelist);var    sysil: thandle;    sfi: tshfileinfo;begin    // 取小图标,即使将shgfi_smallicon替代成    //shgfi_largeicon则表白取大图标    sysil := shgetfileinfo('', 0, sfi, sizeof(sfi),        shgfi_sysiconindex or shgfi_smallicon);    if sysil <> 0 then begin        //将imagelist的图像列表句柄指向体例图像句柄        imagelist.handle := sysil;        //提防组件开释时开释图像句柄,很要害        imagelist.shareimages := true;    end;end;第二步  博得要处置文献的图标索引//取一个文献的图标索引function geticonindex(const afile: string; attrs: dword): integer;//attrs不妨为表白文献或路途file_attribute_normal or file_attribute_directoryvar    sfi: tshfileinfo;       begin    shgetfileinfo(pchar(afile), attrs, sfi, sizeof(tshfileinfo),     shgfi_sysiconindex or shgfi_usefileattributes);    result := sfi.iicon;end;范例挪用://如在treeview中获得c:\mydir的图标,由于是路途以是要加上路途的标记anode.imageindex := geticonindex('c:\mydir\',     file_attribute_normal or file_attribute_directory);//如在treeview中获得c:\index.html的图标anode.imageindex := geticonindex('c:\index.html',file_attribute_normal);

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.