Gui oder GUICtrlCreateGraphic mit $WS_HSCROLL, aber wie?

  • Hallo, ich hab auch mal wieder eine Frage. Und zwar bastle ich an einer Trendanzeige für die ich einen horizontalen Scrollbalken benötigen würde. Die Frage ist nur wie man dem Scrollbalken sagt was sein 'horizontaler Extend' ist, also wo Anfang und Ende des Scrollbereiches ist.
    Also wenn der Trend am Ende der Gui angelangt ist, dann soll der Trendbereich scrollbar sein.
    Ich hoffe mit folgendem Beispiel versteht ihr mein Anliegen.

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <Date.au3>
    #include <GUIConstantsEx.au3>
    #include <StructureConstants.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #Include <File.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aWerte[1], $Run = 1
    Global $title = 'Trend-Test'
    Global $iWidth = 800, $iHeight = 500
    Global $tRECT = DllStructCreate($tagRECT)

    [/autoit] [autoit][/autoit] [autoit]

    $aWerte[0] = _Now()
    #Region Simulation
    For $i = 1 To 790
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    Next
    #Endregion Simulation

    [/autoit] [autoit][/autoit] [autoit]

    $gui = GUICreate("Trend-Simulation by funkey", $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI ,$WS_HSCROLL)) ;funktioniert nicht so wie ich will
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    $Trend = _GUITrendCreate($aWerte, 0, 0, $iWidth *2, $iHeight)
    _GUITrendInitialize($aWerte, $Trend, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    AdlibEnable("_Simulation", 500)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(5000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendCreate($aDaten, $iPosx, $iPosy, $iWidth, $iHeight, $Color = '0xFF0000')
    Local $TrendID
    $TrendID = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight);, $WS_HSCROLL) ;funktioniert nicht so wie ich will
    GUICtrlSetBkColor($TrendID, 0xffffff)
    GUICtrlSetGraphic($TrendID, $GUI_GR_COLOR, $Color)
    Return $TrendID
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendInitialize($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, 0, $iHeight - $aDaten[1])
    For $i = 0 To UBound($aDaten) - 2
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, $i, $iHeight - $aDaten[$i+1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, $i, $iHeight - $aDaten[$i+1])
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendUpdate($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    DllStructSetData($tRECT, 1, UBound($aWerte) -2)
    DllStructSetData($tRECT, 2, 0)
    DllStructSetData($tRECT, 3, UBound($aWerte) -1)
    DllStructSetData($tRECT, 4, $iHeight)
    _WinAPI_RedrawWindow($gui, $tRECT)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Local $Zeit = StringReplace(_Now(), ':', '_')
    If Not FileExists(@ScriptDir & '\logfiles\') Then DirCreate(@ScriptDir & '\logfiles\')
    _FileWriteFromArray(@ScriptDir & '\logfiles\Daten_'&$Zeit&'.log', $aWerte)
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Simulation()
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    _GUITrendUpdate($aWerte, $Trend, $iHeight)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]
  • wieso übergibst du den Funktionen immer $a_daten und nutzt die Variable dann gar nicht (außer bei Initialize) ?

  • Ich gebe zu dieser Parameter bei der Funktionen _GUITrendCreate ist noch ein Überbleibsel vom Testen. Die anderen Funktionen verwenden allerdings diesen Parameter.
    Aber das hat leider nichts mit meinem Problem zu tun :(
    Ich brauche diese Variable beim richtigen Programm und nicht bei dieser Simulation.

    • Offizieller Beitrag

    Bin auch schon auf die Idee gekommen , bastel auch schon damit rum. Wenn ich die Funktionen der UDf benutze , wird aber die Grafik nicht Upgedatet ,wenn man die Gui mit dem Scrollbar verschiebt.
    Das hab ich bis jetzt .

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <Date.au3>
    #include <File.au3>
    #include <WinAPI.au3>
    #include <GUIConstantsEx.au3>
    #include <StructureConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiScrollBars.au3>
    #include <ScrollBarConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aWerte[1], $Run = 1
    Global $title = 'Trend-Test'
    Global $iWidth = 800, $iHeight = 500
    Global $tRECT = DllStructCreate($tagRECT)

    [/autoit] [autoit][/autoit] [autoit]

    $aWerte[0] = _Now()
    #Region Simulation
    For $i = 1 To 790
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    Next
    #Endregion Simulation

    [/autoit] [autoit][/autoit] [autoit]

    $gui = GUICreate("Trend-Simulation by funkey", $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI ,$WS_HSCROLL)) ;funktioniert nicht so wie ich will
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    $Trend = _GUITrendCreate($aWerte, 0, 0, $iWidth *2, $iHeight)
    _GUITrendInitialize($aWerte, $Trend, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    ;GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")

    [/autoit] [autoit][/autoit] [autoit]

    _GUIScrollBars_Init($gui)
    _GUIScrollBars_SetScrollRange($gui, $SB_HORZ, 600, 790)
    AdlibEnable("_Simulation", 500)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(5000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendCreate($aDaten, $iPosx, $iPosy, $iWidth, $iHeight, $Color = '0xFF0000')
    Local $TrendID
    $TrendID = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight);, $WS_HSCROLL) ;funktioniert nicht so wie ich will
    GUICtrlSetBkColor($TrendID, 0xffffff)
    GUICtrlSetGraphic($TrendID, $GUI_GR_COLOR, $Color)
    Return $TrendID
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendInitialize($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, 0, $iHeight - $aDaten[1])
    For $i = 0 To UBound($aDaten) - 2
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, $i, $iHeight - $aDaten[$i+1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, $i, $iHeight - $aDaten[$i+1])
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendUpdate($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    DllStructSetData($tRECT, 1, UBound($aWerte) -2)
    DllStructSetData($tRECT, 2, 0)
    DllStructSetData($tRECT, 3, UBound($aWerte) -1)
    DllStructSetData($tRECT, 4, $iHeight)
    _WinAPI_RedrawWindow($gui, $tRECT)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Local $Zeit = StringReplace(_Now(), ':', '_')
    If Not FileExists(@ScriptDir & '\logfiles\') Then DirCreate(@ScriptDir & '\logfiles\')
    _FileWriteFromArray(@ScriptDir & '\logfiles\Daten_'&$Zeit&'.log', $aWerte)
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Simulation()
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    _GUITrendUpdate($aWerte, $Trend, $iHeight)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $ivMax = $aSB_WindowInfo[$index][7]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

    [/autoit] [autoit][/autoit] [autoit]

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    [/autoit] [autoit][/autoit] [autoit]

    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_SIZE

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
    Local $index = -1, $yChar, $yPos
    Local $Min, $Max, $Page, $Pos, $TrackPos

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Get all the vertial scroll bar information
    Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
    $Min = DllStructGetData($tSCROLLINFO, "nMin")
    $Max = DllStructGetData($tSCROLLINFO, "nMax")
    $Page = DllStructGetData($tSCROLLINFO, "nPage")
    ; Save the position for comparison later on
    $yPos = DllStructGetData($tSCROLLINFO, "nPos")
    $Pos = $yPos
    $TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

    [/autoit] [autoit][/autoit] [autoit]

    Switch $nScrollCode
    Case $SB_TOP ; user clicked the HOME keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Min)

    [/autoit] [autoit][/autoit] [autoit]

    Case $SB_BOTTOM ; user clicked the END keyboard key
    DllStructSetData($tSCROLLINFO, "nPos", $Max)

    [/autoit] [autoit][/autoit] [autoit]

    Case $SB_LINEUP ; user clicked the top arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

    [/autoit] [autoit][/autoit] [autoit]

    Case $SB_LINEDOWN ; user clicked the bottom arrow
    DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    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.

    [/autoit] [autoit][/autoit] [autoit]

    DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    _GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
    ;// If the position has changed, scroll the window and update it
    $Pos = DllStructGetData($tSCROLLINFO, "nPos")

    [/autoit] [autoit][/autoit] [autoit]

    If ($Pos <> $yPos) Then
    _GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
    $yPos = $Pos
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Return $GUI_RUNDEFMSG

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc ;==>WM_VSCROLL

    [/autoit]

    Das liegt am

    [autoit]

    _WinAPI_RedrawWindow($gui, $tRECT)

    [/autoit]

    in der Funktion_GUITrendUpdate das dann die Grafik neu zu zeichnen. Das kann aber nicht gelingen, weil die Startposition des $tRECT außerhalb des sichtbaren Bereiches der Gui liegt .

    • Offizieller Beitrag

    SO, hab noch mal an den Script rumgebastelt. Nachdem ich die Grafik in eine ChildGui gepackt habe funktioniert auch der Aufruf von _WinAPI_RedrawWindow

    Hier mal das Script :

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    #include <Date.au3>
    #include <File.au3>
    #include <WinAPI.au3>
    #include <GUIConstantsEx.au3>
    #include <StructureConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiScrollBars.au3>
    #include <ScrollBarConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $aWerte[1], $Run = 1
    Global $title = 'Trend-Test'
    Global $iWidth = 800, $iHeight = 500
    Global $tRECT = DllStructCreate($tagRECT)

    [/autoit] [autoit][/autoit] [autoit]

    $aWerte[0] = _Now()
    #Region Simulation
    For $i = 1 To 790
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    Next
    #Endregion Simulation

    [/autoit] [autoit][/autoit] [autoit]

    $gui = GUICreate("Trend-Simulation by funkey", $iWidth, $iHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI ,$WS_HSCROLL)) ;funktioniert nicht so wie ich will
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetState()
    $GrafikGui = GUICreate("", $iWidth *2, $iHeight, 0,0,BitOR($WS_CHILD, $WS_TABSTOP),-1, $gui)
    $Trend = _GUITrendCreate($aWerte, 0, 0, $iWidth *2, $iHeight)
    _GUITrendInitialize($aWerte, $Trend, $iHeight)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")

    [/autoit] [autoit][/autoit] [autoit]

    _GUIScrollBars_Init($gui,$iWidth*2-20)
    _GUIScrollBars_ShowScrollBar($GUI, $_SCROLLBARCONSTANTS_SB_VERT, False)
    AdlibEnable("_Simulation", 500)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(5000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendCreate($aDaten, $iPosx, $iPosy, $iWidth, $iHeight, $Color = '0xFF0000')
    Local $TrendID
    $TrendID = GUICtrlCreateGraphic($iPosx, $iPosy, $iWidth, $iHeight)
    GUICtrlSetBkColor($TrendID, 0xffffff)
    GUICtrlSetGraphic($TrendID, $GUI_GR_COLOR, $Color)
    Return $TrendID
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendInitialize($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, 0, $iHeight - $aDaten[1])
    For $i = 0 To UBound($aDaten) - 2
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, $i, $iHeight - $aDaten[$i+1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, $i, $iHeight - $aDaten[$i+1])
    Next
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUITrendUpdate($aDaten, $TrendID, $iHeight)
    GUICtrlSetGraphic($TrendID, $GUI_GR_LINE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    GUICtrlSetGraphic($TrendID, $GUI_GR_MOVE, UBound($aWerte) -1, $iHeight - $aWerte[UBound($aWerte)-1])
    DllStructSetData($tRECT, 1, UBound($aWerte) -2)
    DllStructSetData($tRECT, 2, 0)
    DllStructSetData($tRECT, 3, UBound($aWerte) -1)
    DllStructSetData($tRECT, 4, $iHeight)
    _WinAPI_RedrawWindow($GrafikGui, $tRECT)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    Local $Zeit = StringReplace(_Now(), ':', '_')
    If Not FileExists(@ScriptDir & '\logfiles\') Then DirCreate(@ScriptDir & '\logfiles\')
    _FileWriteFromArray(@ScriptDir & '\logfiles\Daten_'&$Zeit&'.log', $aWerte)
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Simulation()
    _ArrayInsert($aWerte, UBound($aWerte), Random(300, 350))
    _GUITrendUpdate($aWerte, $Trend, $iHeight)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $wParam
    Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
    For $x = 0 To UBound($aSB_WindowInfo) - 1
    If $aSB_WindowInfo[$x][0] = $hWnd Then
    $index = $x
    $xClientMax = $aSB_WindowInfo[$index][1]
    $xChar = $aSB_WindowInfo[$index][2]
    $yChar = $aSB_WindowInfo[$index][3]
    $ivMax = $aSB_WindowInfo[$index][7]
    ExitLoop
    EndIf
    Next
    If $index = -1 Then Return 0

    [/autoit] [autoit][/autoit] [autoit]

    Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

    ; Retrieve the dimensions of the client area.
    $xClient = BitAND($lParam, 0x0000FFFF)
    $yClient = BitShift($lParam, 16)
    $aSB_WindowInfo[$index][4] = $xClient
    $aSB_WindowInfo[$index][5] = $yClient

    ; Set the vertical scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
    DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

    ; Set the horizontal scrolling range and page size
    DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
    DllStructSetData($tSCROLLINFO, "nMin", 0)
    DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
    DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
    _GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

    [/autoit] [autoit][/autoit] [autoit]

    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_SIZE

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
    #forceref $Msg, $lParam
    Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    Funkey ich hoffe es ist das was du erreichen willst .

    • Offizieller Beitrag

    Nee, war nicht so Zeitaufwendig. :D Hatte die Idee mit der Child-Gui beim lesen des Quelltextes von _WinAPI_RedrawWindow und der Hilfe dazu . Ich dachte mir wenn ich eine Gui in eine andere packe dann ändert sich der Sichtbare Bereich der CHild Gui ja nicht wenn ich die Hautpt-Gui scrolle.Und das hat dann hingehauen .