| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 570 人关注过本帖
标题:vb 提取 ico 图标怎么失真了
只看楼主 加入收藏
Ez330阿牛
Rank: 2
等 级:论坛游民
帖 子:42
专家分:14
注 册:2014-3-5
结帖率:11.11%
收藏
 问题点数:0 回复次数:0 
vb 提取 ico 图标怎么失真了
用以下代码我测试时在图像框里面显示的是真彩色,怎么保存为ico后变成灰色了,在百度上找了几天都找不到答案,希望在这里能得到解答
程序代码:
Public Function GetIconFromFile(Filename As String, IconIndex As Long, UseLargeIcon As Boolean) As Picture
*参数:
*FileName - 包含有图标的文件 (EXE or DLL)
*IconIndex - 欲提取的圉标的索引,从零开始
*UseLargeIcon-如设置为True,则提取大图标,否则提取小图标
*返回值: 包含标标的Picture对象
Dim hlargeicon As Long
Dim hsmallicon As Long
Dim selhandle As Long
* IPicture requires a reference to "Standard OLE Types."
Dim pic As PicBmp
Dim IPic As IPicture
Dim IID_IDispatch As GUID
If ExtractIconEx(Filename, IconIndex, hlargeicon, hsmallicon, 1) > 0 Then
If UseLargeIcon Then
selhandle = hlargeicon
Else
selhandle = hsmallicon
End If
* Fill in with IDispatch Interface ID.
With IID_IDispatch
.Data1 = &H20400
.Data4(0) = &HC0
.Data4(7) = &H46
End With
* Fill Pic with necessary parts.
With pic
.Size = Len(pic) * Length of structure.
.tType = vbPicTypeIcon * Type of Picture (bitmap).
.hBmp = selhandle * Handle to bitmap.
End With
* Create Picture object.
Call OleCreatePictureIndirect(pic, IID_IDispatch, 1, IPic)
* Return the new Picture object.
Set GetIconFromFile = IPic
DestroyIcon hsmallicon
DestroyIcon hlargeicon
End If
End Function
搜索更多相关主题的帖子: 百度 天都 
2014-09-05 11:32
快速回复:vb 提取 ico 图标怎么失真了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018669 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved