找回密码
 加入
搜索
查看: 2145|回复: 3

[GUI管理] 求助 水平滚动条的窗口. 怎麼滾?

[复制链接]
发表于 2012-3-4 17:48:38 | 显示全部楼层 |阅读模式
滾到 黃色 全部看見 該怎麼滾
右上要有最小化 和 關閉
===========================
#include <WindowsConstants.au3>
GUICreate("XXXX",200,100,-1,-1,$WS_HSCROLL)
;--------------------------------------
$Input1 = GUICtrlCreateLabel("",100,8,500,20)
GUICtrlSetBkColor(-1,0xFFFF00)
GUISetState()
While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case -3
                        Exit          
        EndSwitch 
WEnd
===================================================

本帖子中包含更多资源

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

×
发表于 2012-3-4 21:22:33 | 显示全部楼层
GUIRegisterMsg() 以下消息
$WM_SIZE, $WM_VSCROLL, $WM_HSCROLL
再在消息里处理,自己研究吧。
发表于 2012-3-4 21:42:32 | 显示全部楼层
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
$hGUI = GUICreate("XXXX",200,100,-1,-1)
;--------------------------------------
$Input1 = GUICtrlCreateLabel("",100,8,500,20)
GUICtrlSetBkColor(-1,0xFFFF00)
GUISetState()
_GUIScrollBars_Init($hGUI)
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")
While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case -3
                        Exit          
        EndSwitch 
WEnd
        
Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
        #forceref $Msg, $lParam
        Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

        Local $index = -1, $xChar, $xPos
        Local $Min, $Max, $Page, $Pos, $TrackPos

        For $x = 0 To UBound($aSB_WindowInfo) - 1
                If $aSB_WindowInfo[$x][0] = $hWnd Then
                        $index = $x
                        $xChar = $aSB_WindowInfo[$index][2]
                        ExitLoop
                EndIf
        Next
        If $index = -1 Then Return 0

;~         ; Get all the horizontal scroll bar information
        Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
        $Min = DllStructGetData($tSCROLLINFO, "nMin")
        $Max = DllStructGetData($tSCROLLINFO, "nMax")
        $Page = DllStructGetData($tSCROLLINFO, "nPage")
        ; Save the position for comparison later on
        $xPos = DllStructGetData($tSCROLLINFO, "nPos")
        $Pos = $xPos
        $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
        #forceref $Min, $Max
        Switch $nScrollCode

                Case $SB_LINELEFT ; user clicked left arrow
                        DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

                Case $SB_LINERIGHT ; user clicked right arrow
                        DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

                Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
                        DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

                Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
                        DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

                Case $SB_THUMBTRACK ; user dragged the scroll box
                        DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
        EndSwitch

;~    // Set the position and then retrieve it.  Due to adjustments
;~    //   by Windows it may not be the same as the value set.

        DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
        _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
        _GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
        ;// If the position has changed, scroll the window and update it
        $Pos = DllStructGetData($tSCROLLINFO, "nPos")
        If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_HSCROLL
发表于 2012-3-4 21:42:44 | 显示全部楼层
帮助文档抄的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-23 18:36 , Processed in 0.189874 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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