找回密码
 加入
搜索
查看: 14913|回复: 23

[AU3基础] 求助_GUIImageList_AddIcon加截ICO出现马赛克

 火... [复制链接]
发表于 2012-7-15 15:40:15 | 显示全部楼层 |阅读模式
本帖最后由 lhy6456210 于 2012-7-15 15:43 编辑




代码
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
        Local $hImage, $hListView

        GUICreate("ListView Set Outline Color", 800, 600)
        $hListView = GUICtrlCreateListView("", 2, 2, 780,580)
        GUICtrlSetStyle($hListView, $LVS_ICON)
        ; Enable extended control styles
        _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_BORDERSELECT)
        GUISetState()

        ; Load images
        $hImage = _GUIImageList_Create(48,48,5)
        _GUIImageList_Add($hImage, _GUIImageList_AddIcon($hImage,"d:\ico.ico"))
                _GUICtrlListView_SetImageList($hListView, $hImage, 0)

        ; Add columns
        _GUICtrlListView_AddColumn($hListView, "Items")
        

        ; Add items
        _GUICtrlListView_AddItem($hListView, "A01", 0)
        _GUICtrlListView_AddItem($hListView, "A02", 0)
        _GUICtrlListView_AddItem($hListView, "A03", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A01", 0)
        _GUICtrlListView_AddItem($hListView, "A02", 0)
        _GUICtrlListView_AddItem($hListView, "A03", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)

        ; Set outline color
        _GUICtrlListView_SetOutlineColor($hListView, 0x0000FF)


        ; Loop until user exits
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>_Main
ICO在附件里

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×

评分

参与人数 1金钱 -20 贡献 -1 收起 理由
afan -20 -1

查看全部评分

 楼主| 发表于 2012-7-15 16:06:34 | 显示全部楼层
继续等待,,等到花开花落
发表于 2012-7-15 20:53:01 | 显示全部楼层
这个小弟不懂,琢磨着  会不会  是数值 的失误
发表于 2012-7-15 21:11:03 | 显示全部楼层
_GUIImageList_Create(48,48,5)的问题。把48改成32试试。
发表于 2012-7-15 21:43:47 | 显示全部楼层
21行 改为 _GUIImageList_AddIcon($hImage, "d:\ico.ico", 0, 1)
不过,_GUIImageList_Create 貌似最大只支持装入 32 * 32,大于该数值的都会被像素放大。如无特殊要求,应该使用 32 * 32,否则,应该载入位图,而非 Icon
发表于 2012-7-15 22:51:26 | 显示全部楼层
在WGLM回了,这也补上吧:

代码:
游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2012-7-15 23:12:31 | 显示全部楼层
回复 7# sliqi

都是抄来的
发表于 2012-7-15 23:36:51 | 显示全部楼层
按照位图解析了吧 。。。
发表于 2012-7-16 03:10:16 | 显示全部楼层
看看需要回复的东西
发表于 2012-7-16 07:08:57 | 显示全部楼层
本帖最后由 user3000 于 2012-7-16 07:11 编辑

回复学习下鬼下的相关代码.
(最近很懒, 几乎不想打字, 鬼鬼为什么还隐藏代码?)

补充:
没看到哪里有7楼有提到的跟 GDI 有关的代码.
发表于 2012-7-16 08:59:35 | 显示全部楼层
回复  sliqi

都是抄来的
benkel 发表于 2012-7-15 23:12


网盟群里你解释了半天。
发表于 2012-7-16 09:02:11 | 显示全部楼层
五楼说的对。
发表于 2012-7-16 13:18:08 | 显示全部楼层
回复 12# lpxx

L老师
发表于 2012-7-16 15:21:03 | 显示全部楼层
老鬼威武。。
发表于 2012-7-17 09:25:43 | 显示全部楼层
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <winapiex.au3>

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
        Local $hImage, $hListView

        GUICreate("ListView Set Outline Color", 800, 600)
        $hListView = GUICtrlCreateListView("", 2, 2, 780,580)
        GUICtrlSetStyle($hListView, $LVS_ICON)
        ; Enable extended control styles
        _GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_BORDERSELECT)
        GUISetState()

        ; Load images
        $hImage = _GUIImageList_Create(48,48,5,1)
        _GUIImageList_Add($hImage, __GUIImageList_AddIcon($hImage,"ico.ico",0))
                _GUICtrlListView_SetImageList($hListView, $hImage, 0)

        ; Add columns
        _GUICtrlListView_AddColumn($hListView, "Items")
        

        ; Add items
        _GUICtrlListView_AddItem($hListView, "A01", 0)
        _GUICtrlListView_AddItem($hListView, "A02", 0)
        _GUICtrlListView_AddItem($hListView, "A03", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A01", 0)
        _GUICtrlListView_AddItem($hListView, "A02", 0)
        _GUICtrlListView_AddItem($hListView, "A03", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)
        _GUICtrlListView_AddItem($hListView, "A04", 0)

        ; Set outline color
        _GUICtrlListView_SetOutlineColor($hListView, 0x0000FF)


        ; Loop until user exits
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>_Main


Func __GUIImageList_AddIcon($hWnd, $sFile, $iIndex = 0)
        Local $iRet
        $iRet = _WinAPI_ShellExtractIcon($sFile, $iIndex, _GUIImageList_GetIconWidth($hWnd), _GUIImageList_GetIconWidth($hWnd))
        If $iRet <= 0 Then Return SetError(-1, $iRet, 0)

        Local $hIcon = $iRet
        $iRet = _GUIImageList_ReplaceIcon($hWnd, -1, $hIcon)
        _WinAPI_DestroyIcon($hIcon)
        If $iRet = -1 Then Return SetError(-2, $iRet, 0)
        Return $iRet
EndFunc   ;==>__GUIImageList_AddIcon
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 12:05 , Processed in 0.089595 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表