成都网站建设设计

将想法与焦点和您一起共享

vb.net获得文件图标 vbnet filestream

vb.net怎样获取应用程序的图标

''' summary

为企业提供网站设计、成都网站制作、网站优化、成都营销网站建设、竞价托管、品牌运营等营销获客服务。成都创新互联拥有网络营销运营团队,以丰富的互联网营销经验助力企业精准获客,真正落地解决中小企业营销获客难题,做到“让获客更简单”。自创立至今,成功用技术实力解决了企业“网站建设、网络品牌塑造、网络营销”三大难题,同时降低了营销成本,提高了有效客户转化率,获得了众多企业客户的高度认可!

''' Returns an icon for a given file - indicated by the name parameter.

''' /summary

''' param name="name"Pathname for file./param

''' param name="size"Large or small/param

''' param name="linkOverlay"Whether to include the link icon/param

''' returnsSystem.Drawing.Icon/returns

Public Shared Function GetFileIcon(ByVal name As String, ByVal size As IconSize, ByVal linkOverlay As Boolean) As System.Drawing.Icon

Dim shfi As New Shell32.SHFILEINFO()

Dim flags As UInteger = Shell32.SHGFI_ICON Or Shell32.SHGFI_USEFILEATTRIBUTES

If True = linkOverlay Then

flags += Shell32.SHGFI_LINKOVERLAY

End If

' Check the size specified for return.

If IconSize.Small = size Then

flags += Shell32.SHGFI_SMALLICON

Else

flags += Shell32.SHGFI_LARGEICON

End If

Shell32.SHGetFileInfo(name, Shell32.FILE_ATTRIBUTE_NORMAL, shfi, CInt(System.Runtime.InteropServices.Marshal.SizeOf(shfi)), flags)

' Copy (clone) the returned icon to a new object, thus allowing us to clean-up properly

Dim icon As System.Drawing.Icon = DirectCast(System.Drawing.Icon.FromHandle(shfi.hIcon).Clone(), System.Drawing.Icon)

User32.DestroyIcon(shfi.hIcon)

' Cleanup

Return icon

end function

vb.net 获得电脑图标

vb.net安装后自带非常多的图标,我的是vb2008,其路径为:C:\Program Files\Microsoft Visual Studio 9.0\Common7\VS2008ImageLibrary\2052\VS2008ImageLibrary

自己解压VS2008ImageLibrary后就能看到大量的常用图标

VB.NET如何获取其他程序集里的图标??

Icon.ExtractAssociatedIcon(string);

返回指定文件中所包含的图标

//////////////////////////////////////////

可以,你可以使用ToBitmap()方法将其转换为一个将此 Icon 转换为 GDI+ Bitmap。

Image mImage = Icon.ExtractAssociatedIcon(string).ToBitmap();


分享文章:vb.net获得文件图标 vbnet filestream
文章来源:http://chengdu.cdxwcx.cn/article/dohcsjp.html