找回密码
 加入
搜索
查看: 2459|回复: 9

怎么实现这种按钮 我找了所有的 都不行

[复制链接]
发表于 2008-7-19 15:14:14 | 显示全部楼层 |阅读模式
在鼠标没经过的时候是和地层窗口平齐的





然后鼠标经过以后就凸起来了
我找了所有的风格 都没有  请问大家谁知道 给我讲一下 谢谢  
我在做游戏更新的东西

[ 本帖最后由 kryiran 于 2008-7-26 05:17 编辑 ]

本帖子中包含更多资源

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

×
 楼主| 发表于 2008-7-19 15:23:27 | 显示全部楼层

难道没人知道 还是没有这个功能?

难道没人知道 还是没有这个功能?

还是都不愿意说?
发表于 2008-7-21 21:31:34 | 显示全部楼层
 楼主| 发表于 2008-7-22 00:40:41 | 显示全部楼层

还是不对

你给的这些按钮都是凸起来的
我需要的就是按钮本身不是凸起来的
只有鼠标移动在上面才凸起来
发表于 2008-7-24 23:35:29 | 显示全部楼层
#include <GUIConstants.au3>

Global Const $ILC_MASK            = 0x0001
Global Const $ILC_COLOR32               = 0x0020

Global Const $BCM_FIRST      = 0x1600
Global Const $BCM_SETIMAGELIST        = $BCM_FIRST + 0x0002

Global Const $BUTTON_IMAGELIST_ALIGN_LEFT   = 0
Global Const $BUTTON_IMAGELIST_ALIGN_RIGHT  = 1
Global Const $BUTTON_IMAGELIST_ALIGN_TOP    = 2
Global Const $BUTTON_IMAGELIST_ALIGN_BOTTOM = 3
Global Const $BUTTON_IMAGELIST_ALIGN_CENTER = 4 ; Doesn't draw text


$GUI = GUICreate("My GUI")
$ic1 = GUICtrlCreateIcon("shell32.dll", 14, 13, 13, 16, 16)
$ic2 = GUICtrlCreateLabel("Au3论坛", 40, 16, 48, 13)
$b = GUICtrlCreateButton("Au3论坛", 10, 10, 90, 25)
Button_AddIcon($b, "shell32.dll", 14, $BUTTON_IMAGELIST_ALIGN_LEFT)
GUICtrlSetState(-1,$GUI_HIDE)

GUISetState()

While 1

    $m = GUIGetMsg()
   
    If $m = -3 then Exit
   
    $c = GUIGetCursorInfo($GUI)
    If $c[4] = $ic1 or $c[4] = $ic2 Then
        GUICtrlSetState( $b, $GUI_SHOW)
        GUICtrlSetState( $ic1, $GUI_HIDE)
        GUICtrlSetState( $ic2, $GUI_HIDE)
        $c = GUIGetCursorInfo($GUI)
            While $c[4] = $b
                If GUIGetMsg() = $b Then Do_Function()
                $c = GUIGetCursorInfo($GUI)
            WEnd
        GUICtrlSetState( $b, $GUI_HIDE)
        GUICtrlSetState( $ic1, $GUI_SHOW)
        GUICtrlSetState( $ic2, $GUI_SHOW)
    EndIf
WEnd

Func Do_Function()
    MsgBox(0x0, "", "如何?", 3)
EndFunc


Func Button_AddIcon($nID, $sIconFile, $nIconID, $nAlign)
    Local $hIL    = ImageList_Create(16, 16, BitOr($ILC_MASK, $ILC_COLOR32), 0, 1)
    
    Local $stIcon   = DllStructCreate("int")
    ExtractIconEx($sIconFile, $nIconID, DllStructGetPtr($stIcon), 0, 1)
    
    ImageList_AddIcon($hIL, DllStructGetData($stIcon, 1))
    DestroyIcon(DllStructGetData($stIcon, 1))
    
    Local $stBIL    = DllStructCreate("dword;int[4];uint")

    DllStructSetData($stBIL, 1, $hIL)
    
    DllStructSetData($stBIL, 2, 1, 1)
    DllStructSetData($stBIL, 2, 1, 2)
    DllStructSetData($stBIL, 2, 1, 3)
    DllStructSetData($stBIL, 2, 1, 4)

    DllStructSetData($stBIL, 3, $nAlign)
    
    GUICtrlSendMsg($nID, $BCM_SETIMAGELIST, 0, DllStructGetPtr($stBIL))
EndFunc


Func ImageList_Create($nImageWidth, $nImageHeight, $nFlags, $nInitial, $nGrow)
    Local $hImageList = DllCall('comctl32.dll', 'hwnd', 'ImageList_Create', _
                        'int', $nImageWidth, _
                        'int', $nImageHeight, _
                        'int', $nFlags, _
                        'int', $nInitial, _
                        'int', $nGrow)
    Return $hImageList[0]
EndFunc


Func ImageList_AddIcon($hIml, $hIcon)
    Local $nIndex = DllCall('comctl32.dll', 'int', 'ImageList_AddIcon', _
                    'hwnd', $hIml, _
                    'hwnd', $hIcon)
    Return $nIndex[0]
EndFunc


Func ExtractIconEx($sIconFile, $nIconID, $ptrIconLarge, $ptrIconSmall, $nIcons)
    Local $nCount = DllCall('shell32.dll', 'int', 'ExtractIconEx', _
                    'str', $sIconFile, _
                    'int', $nIconID, _
                    'ptr', $ptrIconLarge, _
                    'ptr', $ptrIconSmall, _
                    'int', $nIcons)
    Return $nCount[0]
EndFunc


Func DestroyIcon($hIcon)
    Local $bResult = DllCall('user32.dll', 'int', 'DestroyIcon', _
                    'hwnd', $hIcon)
    Return $bResult[0]
EndFunc



LZ 看下这个么``这个是`以前收集的了`
 楼主| 发表于 2008-7-25 01:16:43 | 显示全部楼层

7楼给的这个还是不对

我试了一下  根本就不知道你这个按钮是怎么了
发表于 2008-7-25 07:06:40 | 显示全部楼层
仅供参考!可配合另一个UDF实现楼主需要的功能!(好像是鼠标移到控件上响应的UDF,具体忘记了!)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 633, 449, 193, 125)
$Label1 = GUICtrlCreateLabel("测试按钮", 45, 40, -1, 17)
$Button1 = GUICtrlCreateButton("测试按钮", 32, 33, 75, 25, 0)
GUICtrlSetState(-1, $GUI_HIDE)

GUISetState(@SW_SHOW)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Label1
                        GUICtrlSetState($Button1, $GUI_SHOW)
                        GUICtrlSetState($Label1, $GUI_HIDE)
                Case $Button1
                        GUICtrlSetState($Button1, $GUI_HIDE)
                        GUICtrlSetState($Label1, $GUI_SHOW)
        EndSwitch
WEnd
发表于 2008-7-25 08:01:46 | 显示全部楼层
应该是工具栏吧,帮助里有
#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, $aStrings[4]
        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 strings
        $aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New")
        $aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open")
        $aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save")
        $aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help")

        ; Add buttons
        _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
        _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
        _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
        _GUICtrlToolbar_AddButtonSep ($hToolbar)
        _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

        ; Loop until user exits
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main
 楼主| 发表于 2008-7-25 13:57:21 | 显示全部楼层

真是太感谢大家了

真心感谢大家的热心帮助
9楼和十楼的回答我刚好用上了  谢谢你们
不过还是么用上
我需要的是按钮

[ 本帖最后由 kryiran 于 2008-7-25 23:12 编辑 ]
发表于 2012-1-7 10:02:58 | 显示全部楼层
深奥学习中.........
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-1 01:25 , Processed in 0.167734 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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