Selbstanpassende GUI / Sidebar

  • Bräuchte mal einige Tipps wie man folgendes am besten angeht:

    Ich möchte gerne eine GUI haben, die am rechten Bildrand andockt, vergleichbar zur windows sidebar. Diese GUI muss allerdings die Position zur Laufzeit anpassen um auf unterschiedliche Bildschirmauflösungen zu reagieren.

    Beispiel:

    Programm wird mit der Bildschirmauflösung 1980x1080 gestartet, die GUI soll immer 180 Pixel breit und 300 Pixel hoch sein. In unserem Fall soll sich die GUI also bei left=1800 und top="mittig" befinden.
    Nun wird die Bildschirmaufösung zur Laufzeit auf 1024x768 reduziert, was natürlich zur Folge hätte, dass sich die GUI ausserhalb des darstellbaren Bereichs befindet.

    Wie würdet ihr das lösen?

    Zusätzlich würde ich mir noch wünschen, dass die Sidebar aus und einklappbar ist bei Mouseover. Das heisst die Breite der GUI soll auf 20 Pixel verringert werden (müsste dann wohl auch an den Rand verschoben werden) und bei Mousover die volle Breite erhalten.
    Dazu noch die Frage wie man Labels realisiert deren Textausrichtung um 90° gedreht ist.

    Ich gestehe noch nicht wirklich nach Antworten gesucht zu haben, war nur gerade ne fixe Idee um einen Ersatz für Desktop icons zu haben welche sich bei Auflösungswechseln ja gerne mal umsortieren. Eine Sidebar wäre dann auch besser zu erreichen wenn man bereits etliche Fenster offen hat und nicht erst minimieren möchte um an die Desktop Icons zukommen. Ich bin heut mal faul und sage einfach, dass ich mch über ein fertiges Beispielscript freuen würde. :P

    Selbstverständlich sind auch Hinweise auf nützliche Funktionen diesbezüglich gerne gesehen.

    Einmal editiert, zuletzt von misterspeed (9. Juli 2011 um 21:22)

    • Offizieller Beitrag

    Ich hatte dazu mal folgende Lösung erstellt:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)

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

    Global Const $AW_SLIDE = 0x40000
    Global Const $AW_HOR_POSITIVE = 0x1 ; left to right
    Global Const $AW_HOR_NEGATIVE = 0x2 ; right to left
    Global Const $AW_ACTIVATE = 0x20000 ; Activates the window
    Global Const $AW_HIDE = 0x10000
    Global Const $iPI = 3.1415926535897932384626433832795
    Global $aChild[3], $aLbl[3], $aGraphics[3], $hWnd, $guiMain, $edit, $closehWnd = 0
    Local $iHTitel = _WinAPI_GetSystemMetrics(4), $iWBorder = _WinAPI_GetSystemMetrics(32)+_WinAPI_GetSystemMetrics(5)
    Local $iWMain = 800, $iHMain = 600, $iWChild = 200, $iHChild = $iHMain-$iHTitel

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

    _GDIPlus_Startup()

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

    Global $guiMain = GUICreate('Main', $iWMain, $iHMain, -1, -1, Default, $GUI_WS_EX_PARENTDRAG)
    $hWnd = WinGetHandle($guiMain)
    GUISetOnEvent(-3, '_ende')
    $edit = GUICtrlCreateEdit('', 15, 15, $iWMain-50, $iHMain-30)
    $aLbl[0] = GUICtrlCreateLabel('', $iWMain-20, 0, 18, 70)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetOnEvent(-1, "_show")
    $aLbl[1] = GUICtrlCreateLabel('', $iWMain-20, 72, 18, 70)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetOnEvent(-1, "_show")
    $aLbl[2] = GUICtrlCreateLabel('', $iWMain-20, 144, 18, 70)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    GUICtrlSetOnEvent(-1, "_show")
    $lblBlank = GUICtrlCreateLabel('', $iWMain-20, 216, 18, $iHMain-216)
    GUICtrlSetBkColor(-1, 0xFFFFFF)
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($guiMain)

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

    $aChild[0] = GUICreate("Child 1", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
    $WS_CAPTION, $WS_EX_MDICHILD, $guiMain)

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

    $aChild[1] = GUICreate("Child 2", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
    $WS_CAPTION, $WS_EX_MDICHILD, $guiMain)

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

    $aChild[2] = GUICreate("Child 3", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
    $WS_CAPTION, $WS_EX_MDICHILD, $guiMain)

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

    GUISetState(@SW_SHOW, $GUImain)
    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')

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

    _ReDrawAngledText()

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

    While 1
    Sleep(100)
    WEnd

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

    Func _ende()
    Exit
    EndFunc

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

    Func _show()
    Local $ID = @GUI_CtrlId
    For $i = 0 To UBound($aChild) -1
    If ($aLbl[$i] <> $ID) And (WinGetState($aChild[$i]) > 5) Then
    $closehWnd = WinGetHandle($aChild[$i])
    _hide()
    EndIf
    Next
    For $i = 0 To UBound($aChild) -1
    If ($aLbl[$i] = $ID) And (WinGetState($aChild[$i]) > 5) Then
    $closehWnd = WinGetHandle($aChild[$i])
    Return _hide()
    EndIf
    Next
    For $i = 0 To UBound($aLbl) -1
    If $aLbl[$i] = $ID Then _slideIn(WinGetHandle($aChild[$i]))
    Next
    EndFunc

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

    Func _hide()
    Local $hWnd = @GUI_WinHandle
    If $closehWnd Then
    $hWnd = $closehWnd
    $closehWnd = 0
    EndIf
    Return _slideOut($hWnd)
    EndFunc

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

    Func _slideIn($hWnd)
    Local $width = $iWMain-30-$iWChild-$iWBorder-21
    ControlMove($guiMain, '', $edit, 15, 15, $width, $iHMain-30)
    AnimateWindow($hWnd, BitOR($AW_SLIDE, $AW_ACTIVATE, $AW_HOR_NEGATIVE))
    EndFunc

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

    Func _slideOut($hWnd)
    AnimateWindow($hWnd, BitOR($AW_SLIDE, $AW_HIDE, $AW_HOR_POSITIVE))
    Local $width = $iWMain-50
    ControlMove($guiMain, '', $edit, 15, 15, $width, $iHMain-30)
    EndFunc

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

    Func AnimateWindow($hWnd, $dwFlags, $dwTime=100)
    DllCall("user32", 'long', 'AnimateWindow', 'hwnd', $hWnd, 'long', $dwTime, 'long', $dwFlags)
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText()
    GDIPlus_SetAngledText($hGraphics, 'Pinn 1', 790, 35, 270, "Courier New", 12, 0xFF0000FF)
    GDIPlus_SetAngledText($hGraphics, 'Pinn 2', 790, 107, 270, "Courier New", 12, 0xFF0000FF)
    GDIPlus_SetAngledText($hGraphics, 'Pinn 3', 790, 179, 270, "Courier New", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $guiMain Then _ReDrawAngledText()
    EndFunc

    [/autoit]


    Kurze Erklärung: Mit Klick auf die senkrechten Label werden die Childs ein/ausgeschoben.

    Funktioniert unter XP tadellos, unter Win 7 gibt es Probleme mit _WinAPI_GetSystemMetrics, daher ist das Ergebnis dort nicht überzeugend. Habe bisher allerdings noch nicht nach einer Lösung für Win 7 gesucht.

  • Aso das hatte ich ganz vergessen zu erwähnen. Das ganze soll primär unter win2k8R2 laufen, also Win7 Basis. Hintergrund der dynamischen Anpassung an die Auflösung zur Laufzeit ist hier, dass sich die unterschiedlichsten User mit dem selben Benutzer Account via RDP Verbindung verbinden und es dann zu verschiedenen Auflösungen kommt, wenn man dies nicht serverseitig auf einen fixen Wert einstellen möchte. Werde mir dein Script aber nachher mal ansehen.

    @ meistertogo:

    Das Problem mit @Desktopheight war soweit ich das noch weiss, dass die Taskbar hier nicht korrekt berücksichtigt wird (evtl. auch Windowsversions und Einstellungs abhängig [2-Zeilige Taskbar]), sollte ich also statt einer fixen GUI höhe doch eine dynamisch füllende Höhe haben wollen könnte das auch problematisch werden. Muss ich aber nachher mal rumtesten.

  • So erstmal danke an Bugfix für die GDIplus Geschichte für das "gedrehte" Label. Leider klappt das bei mir nur beim Start. Wird das Fenster verschoben sieht man zwar wie die Schrift durch _wm_move erneut gezeichnet wird, doch sobald das Fenster an seiner Zielposition ist scheint die Schrift hinter dem Label zu verschwinden. Kannst du dir das mal ansehen? Ausserdem Suche ich noch nach einer Möglichkeit die Desktophöhe abzüglich der Taskbar auszulesen. Slide Funktion (ich denke ich schiebe einfach nur das Fenster nach rechts in den unsichtbaren Raum) mit Mouseover wäre dann das nächste was ich noch gerne umsetzen würde. Da wäre die Frage wie man ein Mousover erkennen kann.

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>

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

    ; gui kann derzeit nur mit ESC beendet werden...

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

    $orientation = "rechts"
    $taskbar = 60 ; wie kann man hier den exakten wert auslesen?

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = 600
    $posLeft = @DesktopWidth - $guiWith
    $posTop = ( (@DesktopHeight-$taskbar) / 2) - ($guiHight / 2)
    EndIf

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

    _GDIPlus_Startup()
    Global Const $iPI = 3.1415926535897932384626433832795

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

    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS), $WS_EX_TOPMOST)
    GUISetBkColor(0xA6CAF0)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button1 = GUICtrlCreateButton("Tool 1", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button2 = GUICtrlCreateButton("Tool 2", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')
    _ReDrawAngledText()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    EndSwitch
    checkresolution()
    WEnd

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

    Func checkresolution()
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = ( (@DesktopHeight-$taskbar) / 2) - ($guiHight / 2)
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop Then
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,100)
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText()
    GDIPlus_SetAngledText($hGraphics, 'Ausblenden', 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $gui Then _ReDrawAngledText()
    EndFunc

    [/autoit]

    EDIT: Testweise habe ich $labelleft mit gui_disable deaktiviert und die window styles auf ws_popup und ws_ex_topmost beshränkt, jedoch tritt das Problem mit der verschwindenen Schrift immernoch auf, seltsamerweise überwiegend wenn man die auflösung in x Richtung verringert, aber auch beim erhöhen des x-wertes kommt es sporadisch zum unsichtbar werden der Schrift.

    Einmal editiert, zuletzt von misterspeed (9. Juli 2011 um 16:00)

  • Spoiler anzeigen
    [autoit]

    #Region - Timestamp
    ;2011-07-09 16:37:36
    #EndRegion

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

    #include <array.au3>
    $aResult = _GetWorkingArea()
    _ArrayDisplay($aResult)
    ;===============================================================================
    ;
    ; Function Name: _GetWorkingArea()
    ; Description: Returns the coordinates of desktop working area rectangle
    ; Parameter(s): None
    ; Return Value(s): On Success - Array containing coordinates:
    ; $a[0] = left
    ; $a[1] = top
    ; $a[2] = right
    ; $a[3] = bottom
    ; On Failure - 0
    ;
    ;===============================================================================
    Func _GetWorkingArea()
    #cs
    BOOL WINAPI SystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
    uiAction SPI_GETWORKAREA = 48
    #ce
    Local $dRECT = DllStructCreate("long; long; long; long")
    Local $spiRet = DllCall("User32.dll", "int", "SystemParametersInfo", _
    "uint", 48, "uint", 0, "ptr", DllStructGetPtr($dRECT), "uint", 0)
    If @error Then Return 0
    If $spiRet[0] = 0 Then Return 0
    Local $aRet[4] = [DllStructGetData($dRECT, 1), DllStructGetData($dRECT, 2), DllStructGetData($dRECT, 3), DllStructGetData($dRECT, 4)]
    Return $aRet
    EndFunc

    [/autoit]
  • Danke I2C, hatte das vorhin bei msdn gesehen, wusste aber nicht so recht wie der dll call ausschaun muss, da fehlt es mir etwas an Wissen. Hab es daher dann anders realisiert, hier mal der aktuelle Quellcode:

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <array.au3>

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

    $orientation = "rechts"
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $taskbar = 0
    Else
    $taskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = 600
    $posLeft = @DesktopWidth - $guiWith
    $posTop = (@DesktopHeight-$taskbar-$guiHight)/2
    EndIf

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

    _GDIPlus_Startup()
    Global Const $iPI = 3.1415926535897932384626433832795

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

    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, $WS_POPUP , $WS_EX_TOPMOST) ;;; BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS)
    GUISetBkColor(0xA6CAF0)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($LabelLeft,$GUI_DISABLE)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button1 = GUICtrlCreateButton("Tool 1", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button2 = GUICtrlCreateButton("Tool 2", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')
    _ReDrawAngledText()

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    ConsoleWrite(@CRLF & "exitcall")
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    EndSwitch
    checkresolution()
    WEnd

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

    Func checkresolution()
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = (@DesktopHeight-$newtaskbar-$guiHight)/2
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop or $newtaskbar <> $taskbar Then
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    $taskbar = $newtaskbar
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight);,100)
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText()
    GDIPlus_SetAngledText($hGraphics, 'Ausblenden', 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $gui Then _ReDrawAngledText()
    EndFunc

    [/autoit]

    Das Problem mit dem verschwindenden Text besteht allerdings noch wenn man die Auflösung in X Richtung verringert und Y gleich bleibt, ansonsten scheint das nun recht zuverlässig zu klappen. Testen kann man das am besten mit Virtualbox, da hier die Auflösung dynamisch in alle Richtungen verändert werden kann.

  • So neuester Stand, Mouseover ist soweit eingebaut, jedoch gibt es mit GDI Plus und der Neuzeichnerei Probleme. Derzeit wird der alte Text nicht gelöscht und der neue einfach drüber gezeichnet... kann mir das jemand beheben?

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <winapi.au3>

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

    Global $Mouse_X_Pos = 0 , $visible = True , $i=1
    $orientation = "rechts"
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $taskbar = 0
    Else
    $taskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = 600
    $posLeft = @DesktopWidth - $guiWith
    $posTop = (@DesktopHeight-$taskbar-$guiHight)/2
    EndIf

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

    _GDIPlus_Startup()
    Global Const $iPI = 3.1415926535897932384626433832795

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

    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, $WS_POPUP , $WS_EX_TOPMOST) ;;; BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS)
    GUISetBkColor(0xA6CAF0)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($LabelLeft,$GUI_DISABLE)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button1 = GUICtrlCreateButton("Tool 1", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button2 = GUICtrlCreateButton("Tool 2", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')
    _ReDrawAngledText("Ausblenden")

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    EndSwitch
    checkresolution()
    checkmousepos()
    WEnd

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

    Func checkresolution()
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = (@DesktopHeight-$newtaskbar-$guiHight)/2
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop or $newtaskbar <> $taskbar Then
    ConsoleWrite( @CRLF & "reschange: " & $visible )
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    $taskbar = $newtaskbar
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Ausblenden")
    $visible = True
    EndIf
    EndFunc

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

    Func checkmousepos()
    $curMouse_X_Pos = MouseGetPos(0)
    if $curMouse_X_Pos <> $Mouse_X_Pos Then
    $Mouse_X_Pos = $curMouse_X_Pos
    if $Mouse_X_Pos < $posLeft And $visible = True Then
    ConsoleWrite( @CRLF & "hide: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft+$guiWith-20,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Einblenden")
    $visible = False
    EndIf
    if $Mouse_X_Pos >= @DesktopWidth-20 And $visible = False then
    ConsoleWrite( @CRLF & "show: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Ausblenden")
    $visible = True
    EndIf
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText($labelLefttext)
    GDIPlus_SetAngledText($hGraphics, $labelLefttext, 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($handle)
    If $handle = $gui Then
    ;_ReDrawAngledText()
    $redraw = _WinAPI_UpdateWindow($gui) ; notwendig damit Buttons beim ein/ausblenden gezeichnet werden
    ConsoleWrite(@CRLF & "Redraw: " & $redraw)
    ConsoleWrite(@CRLF & "counter: " & $i)
    $i+=1
    EndIf
    EndFunc

    [/autoit]
  • Soweit ich das sehen kann, müsste man dazu die komplette Funktion umschreiben... Es sei denn man zeichnet einfach ein Rechteck in der Hintergrundfarbe der GUI über den alten Text bei jedem aufruf von _WM_MOVE. Allerdings würde das dann nicht funktionieren wenn du ein Bild darunter hast.

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <winapi.au3>

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

    Global $Mouse_X_Pos = 0 , $visible = True , $i=1
    $orientation = "rechts"
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $taskbar = 0
    Else
    $taskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = 600
    $posLeft = @DesktopWidth - $guiWith
    $posTop = (@DesktopHeight-$taskbar-$guiHight)/2
    EndIf

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

    _GDIPlus_Startup()
    Global Const $iPI = 3.1415926535897932384626433832795

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

    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, $WS_POPUP , $WS_EX_TOPMOST) ;;; BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS)
    GUISetBkColor(0xA6CAF0)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($LabelLeft,$GUI_DISABLE)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button1 = GUICtrlCreateButton("Tool 1", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button2 = GUICtrlCreateButton("Tool 2", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')
    _ReDrawAngledText("Ausblenden")

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    EndSwitch
    checkresolution()
    checkmousepos()
    WEnd

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

    Func checkresolution()
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = (@DesktopHeight-$newtaskbar-$guiHight)/2
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop or $newtaskbar <> $taskbar Then
    ConsoleWrite( @CRLF & "reschange: " & $visible )
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    $taskbar = $newtaskbar
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Ausblenden")
    $visible = True
    EndIf
    EndFunc

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

    Func checkmousepos()
    $curMouse_X_Pos = MouseGetPos(0)
    if $curMouse_X_Pos <> $Mouse_X_Pos Then
    $Mouse_X_Pos = $curMouse_X_Pos
    if $Mouse_X_Pos < $posLeft And $visible = True Then
    ConsoleWrite( @CRLF & "hide: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft+$guiWith-20,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Einblenden")
    $visible = False
    EndIf
    if $Mouse_X_Pos >= @DesktopWidth-20 And $visible = False then
    ConsoleWrite( @CRLF & "show: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("Ausblenden")
    $visible = True
    EndIf
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0, $iARGB_BG = 0xFF3399FF)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $hBrushBG = _GDIPlus_BrushCreateSolid($iARGB_BG)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsFillRect($hGraphic, $iXt, $iYt, $iWidth, $iHeight, $hBrushBG)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrushBG)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText($labelLefttext)
    GDIPlus_SetAngledText($hGraphics, $labelLefttext, 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($handle)
    If $handle = $gui Then
    ;_ReDrawAngledText()
    $redraw = _WinAPI_UpdateWindow($gui) ; notwendig damit Buttons beim ein/ausblenden gezeichnet werden
    ConsoleWrite(@CRLF & "Redraw: " & $redraw)
    ConsoleWrite(@CRLF & "counter: " & $i)
    $i+=1
    EndIf
    EndFunc

    [/autoit]


    Ich hab mal einfach eine Hintergrundfarbe als möglichen Parameter in die Funktion eingefügt.

  • Hi,

    ich habe soetwas auch schon angefangen, habe allerdings die lust verloren.

    hier der Code:

    Spoiler anzeigen
    [autoit]

    #include <Misc.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiMonthCal.au3>
    #include <GDIPlus.au3>
    Global $Maus_Position[2]
    $Fenster = GUICreate("Meine GUI", 172, 500, @DesktopWidth - 172, 1,$WS_POPUP)
    WinSetTrans($Fenster, "", 150)
    GUISetBkColor(0x00FF00)
    GUISetState()
    $Kalender = _GUICtrlMonthCal_Create($Fenster, 5,5)
    $Uhr_rahmen_1 = GUICtrlCreateGraphic(5, 168, 162, 60);Außen
    $Uhr_rahmen_2 = GUICtrlCreateGraphic(7, 170, 158, 56);Innen
    GUICtrlSetColor($Uhr_rahmen_1, 0x000000)
    GUICtrlSetColor($Uhr_rahmen_2, 0x000000)
    $Uhrzeit_Label = GUICtrlCreateLabel(@HOUR & " : " & @MIN & " : " & @SEC, 12, 180, 148, 35)
    GUICtrlSetFont($Uhrzeit_Label, 22, 148)
    $btn_Einstellungen = GUICtrlCreateButton("Einstellungen", 5, 460, 162, 35)
    $con_menu = GUICtrlCreateContextMenu()
    $con_menu_beenden = GUICtrlCreateMenuItem("Beenden", $con_menu)
    start()
    func Start()
    $Maus_Position[0] = 0
    $Maus_Position[1] = 0
    EndFunc
    $Breite = 0
    $Hoehe = 0
    $time = @HOUR & ":" & @MIN & " : " & @SEC
    $sec = @SEC
    $var = 0
    Global $Fenster_Position = WinGetPos("Meine GUI")
    Global $Maus_Position = MouseGetPos()
    while 1
    $msg = GUIGetMsg()
    $time_new = @HOUR & " : " & @MIN & " : " & @SEC
    Select
    case $Breite = $Fenster_Position[2]
    $Breite = 0
    case $Hoehe = $Fenster_Position[3]
    $Hoehe = 0
    case _IsPressed(01) And $Fenster_Position[0] + $Breite And $Fenster_Position[1] + $Hoehe
    $Maus_Position_Vorher = MouseGetPos()
    While _IsPressed(01) = 1
    $Maus_Position = MouseGetPos()
    WinMove("Meine GUI", "", $Maus_Position[0] - $Maus_Position_Vorher[0] + $Fenster_Position[0], $Maus_Position[1] - $Maus_Position_Vorher[1] + $Fenster_Position[1])
    WEnd
    case $msg = $GUI_EVENT_CLOSE
    Exit
    case _IsPressed(02)
    $Breite += 1
    $Hoehe += 1
    case $msg = $con_menu_beenden
    Exit
    case $time <> $time_new
    GUICtrlSetData($Uhrzeit_Label, @HOUR & " : " & @MIN & " : " & @SEC)
    $time = $time_new
    case $Fenster_Position[0] + $Fenster_Position[2] >= @DesktopWidth + 1
    WinMove("Meine GUI", "", @DesktopWidth - 172, $Fenster_Position[1])
    case $Fenster_Position[1] + 1 < 0
    WinMove("Meine GUI", "",$Fenster_Position[0], 1)
    EndSelect
    Global $Fenster_Position = WinGetPos("Meine GUI")
    Global $Maus_Position = MouseGetPos()
    WEnd

    [/autoit]


    Die Gui kannst du auch über die Obere und/oder die Linke Bildschirmkante ziehen, dann "floppt" das Fenster automatisch an die jeweilige Kante/Ecke.

    Du kannst es ruhig weitermachen, bzw. ein paar sache kopieren, etc. ich mache da jedenfalls nicht mehr weiter, also bedien dich ;)

    mfg
    hauke96

  • Hab mir bei dir mal noch die Transparenz und das Kontextmenu abgeschaut. Die Lösung von Name22 funktioniert soweit auch, hab mich aber nun entschieden den Text doch nicht zu verändern, sah irgendwo seltsam aus.
    Da mir gerade nix mehr einfällt was man noch ändern könnte betrachte ich den Thread einfach mal als gelöst. Der Vollständigkeit wegen hier noch die fertige Fassung:

    Changes:
    - kein Tray Icon mehr
    - kein Taskbar Eintrag mehr
    - Transparenz
    - Kontextmenu

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <winapi.au3>

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

    AutoItSetOption ( "TrayIconHide" , 1 )

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

    Global Const $iPI = 3.1415926535897932384626433832795
    Global $Mouse_X_Pos = 0 , $visible = True , $i=1

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

    $orientation = "rechts"
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $taskbar = 0
    Else
    $taskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = 600
    $posLeft = @DesktopWidth-$guiWith
    $posTop = (@DesktopHeight-$taskbar-$guiHight)/2
    EndIf

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

    $hParent = GUICreate("parent")
    GUISetState(@SW_HIDE,$hParent)
    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, $WS_POPUP , $WS_EX_TOPMOST, $hParent) ;;; BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS)
    GUISetBkColor(0xA6CAF0)
    WinSetTrans($gui, "", 222)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($LabelLeft,$GUI_DISABLE)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button1 = GUICtrlCreateButton("Tool 1", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $Button2 = GUICtrlCreateButton("Tool 2", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $con_menu = GUICtrlCreateContextMenu()
    $con_menu_beenden = GUICtrlCreateMenuItem("Beenden", $con_menu)

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

    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    _ReDrawAngledText("My Sidebar")

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

    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE , $con_menu_beenden
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    EndSwitch
    checkresolution()
    checkmousepos()
    WEnd

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

    Func checkresolution()
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = (@DesktopHeight-$newtaskbar-$guiHight)/2
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop or $newtaskbar <> $taskbar Then
    ConsoleWrite( @CRLF & "reschange: " & $visible )
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    $taskbar = $newtaskbar
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    _ReDrawAngledText("My Sidebar")
    $visible = True
    EndIf
    EndFunc

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

    Func checkmousepos()
    $curMouse_X_Pos = MouseGetPos(0)
    if $curMouse_X_Pos <> $Mouse_X_Pos Then
    $Mouse_X_Pos = $curMouse_X_Pos
    if $Mouse_X_Pos < $posLeft And $visible = True Then
    ConsoleWrite( @CRLF & "hide: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft+$guiWith-20,$posTop,$guiWith,$guiHight,5)
    ;_ReDrawAngledText("My Sidebar")
    $visible = False
    EndIf
    if $Mouse_X_Pos >= @DesktopWidth-20 And $visible = False then
    ConsoleWrite( @CRLF & "show: " & $Mouse_X_Pos )

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

    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,5)
    ;_ReDrawAngledText("My Sidebar")
    $visible = True
    EndIf
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText($labelLefttext)
    GDIPlus_SetAngledText($hGraphics, $labelLefttext, 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($handle)
    If $handle = $gui Then
    ;_ReDrawAngledText()
    $redraw = _WinAPI_UpdateWindow($gui) ; notwendig damit Buttons beim ein/ausblenden gezeichnet werden
    ConsoleWrite(@CRLF & "Redraw: " & $redraw)
    ConsoleWrite(@CRLF & "counter: " & $i)
    $i+=1
    EndIf
    EndFunc

    [/autoit]
  • Keine Ahnung was du genau meinst, aber da waren noch etliche Fehler drin. Eventuell lag es bei dir an der Auflösung, denn die Höhe der GUI war ja fix eingestellt. In der jetzigen Version wird immer die komplette verfügabre Bildhöhe verwendet. also ebenfalls dynamisch. Was noch stört ist dieser GDI redraw Kram, dadurch wird die Schrift unscharf und fett, werde wohl doch noch Name's Methode einbauen um den Text vor dem Neuzeichnen mit einem Rechteck zu übermalen. Ausserdem noch nicht berücksichtigt sind einklappendene Taskleisten, da dürfte evtl die dll Methode von i2c helfen.

    Hier mal ein Update:

    Change:
    - multiple Ordner via ini Datei öffnen und dynamisch bei wechselnden Auflösungen anordnen und resizen
    - Winsettitle für geöffnete Ordner (funktioniert nicht immer, ggf. wird größeres Sleep benötigt)
    - Diverse Bugfixes bei der dynamischen Sidebar Anpassung
    - GUI Höhe nun dynamisch auf Maximalhöhe

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    #include <winapi.au3>
    #include <array.au3>
    #include <file.au3>
    AutoItSetOption ( "TrayIconHide" , 1 )

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

    Global Const $iPI = 3.1415926535897932384626433832795
    Global $Mouse_X_Pos = 0 , $visible = True , $i=1
    Global $folderhandles[1]
    Global $iniFile = @ScriptDir & "\sidebar.ini"
    Global $aPaths[1]
    Global $LastFolderRefresh=-1

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

    readsettings()

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

    $orientation = "rechts"
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $taskbar = 0
    Else
    $taskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $orientation = "rechts" Then
    $guiWith = 200
    $guiHight = @DesktopHeight-$taskbar;600
    $posLeft = @DesktopWidth-$guiWith
    $posTop = (@DesktopHeight-$taskbar-$guiHight)/2
    EndIf

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

    $hParent = GUICreate("parent")
    GUISetState(@SW_HIDE,$hParent)
    $gui = GUICreate("sidebar", $guiWith, $guiHight, $posLeft, $posTop, $WS_POPUP , $WS_EX_TOPMOST, $hParent) ;;; BitOR($WS_DLGFRAME,$WS_POPUP,$WS_CLIPSIBLINGS)
    GUISetBkColor(0xA6CAF0)
    WinSetTrans($gui, "", 222)
    $LabelLeft = GUICtrlCreateLabel("", 0, 0, 20, $guiHight)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($LabelLeft,$GUI_DISABLE)
    $LabelTop = GUICtrlCreateLabel("", 20, 0, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $LabelBottom = GUICtrlCreateLabel("", 20, $guiHight-10, $guiWith-20, 10)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $btnFolderOpen = GUICtrlCreateButton("Ordner öffnen", 30, 20, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    $btnFolderClose = GUICtrlCreateButton("Ordner schliessen", 30, 55, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUICtrlSetState($btnFolderClose,$GUI_DISABLE)
    $btnDebug = GUICtrlCreateButton("Debug", 30, 90, $guiWith-40, 25, 0)
    GUICtrlSetBkColor(-1, 0x3399FF)
    GUISetState(@SW_SHOW)

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

    $con_menu = GUICtrlCreateContextMenu()
    $con_menu_beenden = GUICtrlCreateMenuItem("Beenden", $con_menu)

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

    _GDIPlus_Startup()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($gui)
    _ReDrawAngledText("Desktop Sidebar BETA")

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

    GUIRegisterMsg($WM_MOVE, '_WM_MOVE')

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE , $con_menu_beenden
    _GDIPlus_GraphicsDispose ($hGraphics)
    _GDIPlus_ShutDown ()
    Exit
    Case $btnFolderOpen
    GUICtrlSetState($btnFolderClose,$GUI_ENABLE)
    GUICtrlSetState($btnFolderOpen,$GUI_DISABLE)
    calcFensterPos()
    Case $btnFolderClose
    GUICtrlSetState($btnFolderOpen,$GUI_ENABLE)
    GUICtrlSetState($btnFolderClose,$GUI_DISABLE)
    closeFolders()
    Case $btnDebug
    _ArrayDisplay($aPaths)
    _ArrayDisplay($folderhandles)
    EndSwitch
    checkresolution()
    checkmousepos()
    WEnd

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

    Func readsettings()
    if Not FileExists($iniFile) Then
    _FileCreate($iniFile)
    IniWrite($iniFile,"Ordner","example",@TempDir)
    EndIf
    $aPaths = IniReadSection($iniFile,"Ordner")
    EndFunc

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

    Func calcFensterPos()
    Local $x=0 , $y=0 , $w=(@DesktopWidth-20)/2 , $h=(@DesktopHeight-$taskbar)/2

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

    if UBound($aPaths) > 1 then
    for $i=1 to UBound($aPaths)-1
    openfolder($aPaths[$i][1],$aPaths[$i][0],$x,$y,$w,$h)
    if $x=0 Then
    if $y=$h Then
    $y=0
    ContinueLoop
    EndIf
    $x=$w
    Else
    if $y=0 Then
    $y=$h
    ContinueLoop
    EndIf
    $x=0
    EndIf
    Next
    Else
    ConsoleWrite(@CRLF & "Fehler: Keine Pfade im Array...")
    EndIf
    EndFunc

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

    func openfolder($path,$folderT=-1,$folderX=0,$folderY=0,$folderW=200,$folderH=200)
    Local $vorher=WinList("[CLASS:CabinetWClass]")
    Local $size=UBound($vorher)
    Local $search, $nachher, $handle

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

    ;Run('explorer.exe "' & $path & '"')
    ShellExecute($path)
    Local $timeout = TimerInit()
    do
    $nachher=WinList("[CLASS:CabinetWClass]")
    if TimerDiff($timeout)>2000 then return -1
    Until UBound($nachher)>$size

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

    for $i=1 to $nachher[0][0]
    $search = _ArraySearch($vorher,$nachher[$i][1],1,0,1,0,1,1)
    if $search = -1 then
    $handle = $nachher[$i][1]
    ExitLoop
    Else
    $handle = -1
    EndIf
    Next

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

    if $handle <> -1 then
    _ArrayAdd($folderhandles,$handle)
    WinMove($handle,"",$folderX,$folderY,$folderW,$folderH)
    if $folderT <> -1 then
    Sleep(300)
    WinSetTitle($handle,"",$folderT)
    EndIf
    Else
    ConsoleWrite(@CRLF & "Fehler: Fensterhandle konnte nicht ermittelt werden")
    EndIf
    EndFunc

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

    Func closeFolders()
    if UBound($folderhandles) <= 1 Then Return -1
    for $i = 1 to UBound($folderhandles)-1
    WinClose($folderhandles[$i])
    Next
    ReDim $folderhandles[1]
    EndFunc

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

    Func checkresolution()
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf

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

    if $newtaskbar <> $taskbar then
    Sleep(1000)
    $aTaskbar_Pos = WinGetPos( "[Class:Shell_TrayWnd]")
    if $aTaskbar_Pos = 0 Then
    $newtaskbar = 0
    Else
    $newtaskbar = $aTaskbar_Pos[3]
    EndIf
    EndIf

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

    $newGuiHight = @DesktopHeight-$newtaskbar
    $newPosLeft = @DesktopWidth - $guiWith
    $newPosTop = (@DesktopHeight-$newtaskbar-$newGuiHight)/2
    if $newPosLeft <> $posLeft or $newPosTop <> $posTop or $newtaskbar <> $taskbar or $newGuiHight <> $guiHight Then
    $posLeft = $newPosLeft
    $posTop = $newPosTop
    $taskbar = $newtaskbar
    $guiHight = $newGuiHight
    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,2)
    _ReDrawAngledText("Desktop Sidebar BETA")
    $visible = True
    GUICtrlSetState($btnFolderClose,$GUI_DISABLE)
    GUICtrlSetState($btnFolderOpen,$GUI_DISABLE)
    closeFolders()
    calcFensterPos()
    GUICtrlSetState($btnFolderClose,$GUI_ENABLE)
    EndIf
    EndFunc

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

    Func checkmousepos()
    $curMouse_X_Pos = MouseGetPos(0)
    if $curMouse_X_Pos <> $Mouse_X_Pos Then
    $Mouse_X_Pos = $curMouse_X_Pos
    if $Mouse_X_Pos < $posLeft And $visible = True Then
    ConsoleWrite( @CRLF & "hide: " & $Mouse_X_Pos )
    WinMove($gui,"",$posLeft+$guiWith-20,$posTop,$guiWith,$guiHight,2)
    _ReDrawAngledText("Desktop Sidebar BETA")
    $visible = False
    EndIf
    if $Mouse_X_Pos >= @DesktopWidth-20 And $visible = False then
    ConsoleWrite( @CRLF & "show: " & $Mouse_X_Pos )

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

    WinMove($gui,"",$posLeft,$posTop,$guiWith,$guiHight,2)
    _ReDrawAngledText("Desktop Sidebar BETA")
    $visible = True
    EndIf
    EndIf
    EndFunc

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

    ; #FUNCTION# ================================================================
    ; Name...........: GDIPlus_SetAngledText
    ; Description ...: Adds text to a graphic object at any angle.
    ; Syntax.........: GDIPlus_SetAngledText($hGraphic, $nText, [$iCentreX, [$iCentreY, [$iAngle , [$nFontName , _
    ; [$nFontSize, [$iARGB, [$iAnchor]]]]]]] )
    ; Parameters ....: $hGraphic - The Graphics object to receive the added text.
    ; $nText - Text string to be displayed
    ; $iCentreX - Horizontal coordinate of horixontal centre of the text rectangle (default = 0 )
    ; $iCentreY - Vertical coordinate of vertical centre of the text rectangle (default = 0 )
    ; $iAngle - The angle which the text will be place in degrees. (default = "" or blank = 0 )
    ; $nFontName - The name of the font to be used (default = "" or Blank = "Arial" )
    ; $nFontSize - The font size to be used (default = "" or Blank = 12 )
    ; $iARGB - Alpha(Transparency), Red, Green and Blue color (0xAARRGGBB) (Default= "" = random color
    ; or Default = Blank = 0xFFFF00FF )
    ; $iAnchor - If zero (default) positioning $iCentreX, $iCentreY values refer to centre of text string.
    ; If not zero positioning $iCentreX, $iCentreY values refer to top left corner of text string.
    ; Return values .: 1
    ; Author ........: Malkey
    ; Modified.......:
    ; Remarks .......: Call _GDIPlus_Startup() before starting this function, and call _GDIPlus_Shutdown()after function ends.
    ; Can enter calculation for Angle Eg. For incline, -ATan($iVDist / $iHDist) * 180 / $iPI , where
    ; $iVDist is Vertical Distance, $iHDist is Horizontal Distance, and, $iPI is Pi, (an added Global Const).
    ; When used with other graphics, call this function last. The MatrixRotate() may affect following graphics.
    ; Related .......: _GDIPlus_Startup(), _GDIPlus_Shutdown(), _GDIPlus_GraphicsDispose($hGraphic)
    ; Link ..........;
    ; Example .......; Yes
    ; ========================================================================================
    Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _
    $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0)
    Local $x, $y, $iX, $iY, $iWidth, $iHeight
    Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

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

    ; Default values
    If $iAngle = "" Then $iAngle = 0
    If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" ; "Microsoft Sans Serif"
    If $nFontSize = "" Then $nFontSize = 12
    If $iARGB = "" Then ; Randomize ARGB color
    $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)
    EndIf

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

    $hFormat = _GDIPlus_StringFormatCreate(0)
    $hFamily = _GDIPlus_FontFamilyCreate($nFontName)
    $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3)
    $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0)
    $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat)
    $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))

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

    ;Later calculations based on centre of Text rectangle.
    If $iAnchor = 0 Then ; Reference to middle of Text rectangle
    $iX = $iCentreX
    $iY = $iCentreY
    Else ; Referenced centre point moved to top left corner of text string.
    $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2)
    $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2)
    EndIf

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

    ;Rotation Matrix
    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
    _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

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

    ;x, y are display coordinates of center of width and height of the rectanglular text box.
    ;Top left corner coordinates rotate in a circular path with radius = (width of text box)/2.
    ;Parametric equations for a circle, and adjustments for centre of text box
    $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180)
    $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180)

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

    ;Rotation of Coordinate Axes formulae - To display at x and y after rotation, we need to enter the
    ;x an y position values of where they rotated from. This is done by rotating the coordinate axes.
    ;Use $iXt, $iYt in _GDIPlus_RectFCreate. These x, y values is the position of the rectangular
    ;text box point before rotation. (before translation of the matrix)
    $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180)
    $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180)

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

    $hBrush = _GDIPlus_BrushCreateSolid($iARGB)
    $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)

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

    ; Clean up resources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    $tLayout = ""
    Return 1
    EndFunc ;==>GDIPlus_SetAngledText

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

    Func _ReDrawAngledText($labelLefttext)
    GDIPlus_SetAngledText($hGraphics, $labelLefttext, 10, $guiHight/2, 270, "", 12, 0xFF0000FF)
    EndFunc

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

    Func _WM_MOVE($handle)
    If $handle = $gui Then
    ;_ReDrawAngledText()
    $redraw = _WinAPI_UpdateWindow($gui) ; notwendig damit Buttons beim ein/ausblenden gezeichnet werden
    ConsoleWrite(@CRLF & "Redraw: " & $redraw)
    ConsoleWrite(@CRLF & "counter: " & $i)
    $i+=1
    EndIf
    EndFunc

    [/autoit]
  • hi, ich würde das dazu sagen:
    Wenn sie rechts andocken soll und z.b. 100 Pixel breit ist:
    => @DesktopWidth-100
    Somit funktioniert es schon mal auf alle Bildschirme die unterschiedlich breit sind.
    das geht z.b. auch anders, das ist eigentlich alles nur reine Mathematik,
    aber trotzdem ist bei Mathe Punkt-Vor-Strich angesagt...
    Hoffe es war hilfreich da ich dieses Thema nur überflogen habe.