80107671 发表于 2012-6-20 21:06:14

请问如何在 _GUICtrlToolbar_InsertButton中加入自定义的图片?

如下代码,请问类似这样的图标,如何加入自定义图标呢? 小弟先谢过了@


#include <GuiToolbar.au3>

#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Constants.au3>



Opt('MustDeclareVars', 1)



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



_Main()



Func _Main()

    Local $hGUI, $hToolbar

    Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp



    ; Create GUI

    $hGUI = GUICreate("Toolbar", 400, 300)

    $hToolbar = _GUICtrlToolbar_Create($hGUI)

    GUISetState()



    ; Add standard system bitmaps

    _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)



    ; Add buttons

    _GUICtrlToolbar_InsertButton($hToolbar, 0, $idNew, $STD_FILENEW)

    _GUICtrlToolbar_InsertButton($hToolbar, 1, $idOpen, $STD_FILEOPEN)

    _GUICtrlToolbar_InsertButton($hToolbar, 2, $idSave, $STD_FILESAVE)

    _GUICtrlToolbar_AddButtonSep($hToolbar)

    _GUICtrlToolbar_InsertButton($hToolbar, 4, $idHelp, $STD_HELP)



    ; Loop until user exits

    Do

    Until GUIGetMsg() = $GUI_EVENT_CLOSE



EndFunc   ;==>_Main

afan 发表于 2012-6-20 21:41:49

贴代码要用代码标签 【code】#include <GuiToolbar.au3>
#include <GuiImageList.au3>

Local $au3path = RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir')
Local Enum $idNew = 1000, $id1, $id2, $id3

Local $hGUI = GUICreate('Toolbar')
Local $hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

Local $hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUICtrlToolbar_SetImageList($hToolbar, $hImage)
_GUIImageList_AddIcon($hImage, @SystemDir & '\shell32.dll', 9, 1)
_GUIImageList_AddIcon($hImage, $au3path & '\AutoIt3.exe', 0, 1)
_GUIImageList_AddIcon($hImage, $au3path & '\Examples\WinAPIEx\Extras\Soccer.ico', 0, 1)

_GUICtrlToolbar_InsertButton($hToolbar, 0, $id1, 0)
_GUICtrlToolbar_InsertButton($hToolbar, 1, $id2, 1)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_InsertButton($hToolbar, 3, $id3, 2)

Do
Until GUIGetMsg() = -3

atdatura 发表于 2013-6-21 16:45:01

顶,支持
学习

macran 发表于 2015-5-13 02:32:42

_GUICtrlToolbar_InsertButton 和_GUICtrlToolbar_AddButton 有什么区别吗。为什么要有这2个UDF 是不是多次一举吖?
页: [1]
查看完整版本: 请问如何在 _GUICtrlToolbar_InsertButton中加入自定义的图片?