
正文
vb.net读取资源图标 vba资源
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
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
相关问答
Q1: vb.net 获得电脑图标
vb.net安装后自带非常多的图标,我的是vb2008,其路径为:C:\Program Files\Microsoft Visual Studio 9.0\Common7\VS2008ImageLibrary\2052\VS2008ImageLibrary
自己解压VS2008ImageLibrary后就能看到大量的常用图标
Q2: vb.net正在加载图标
网络原因。通过查询vb官网了解显示得知,vb.net正在加载图标是网络原因导致的,VB.NET是一种简单,现代,,它由微软开发,将NET Framework和公共语言运行库的强大功能相结合。
vb.net读取资源图标的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vba资源、vb.net读取资源图标的信息别忘了在本站进行查找喔。







