• Offizieller Beitrag

    Hi,
    bevor ich wieder ewig nach dem Skript suche, werde ich es mal schnell hier posten. ;)
    Es existiert eine "Pinnleiste" in Form von vertikalen Labels. Über diese Labels wird bei Klick das zugehörige Child ein-/ausgefadet.
    (Kann sein, dass ich es schonmal geposted habe - aber ich finde es nicht mehr ;))

    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]

    $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)

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

    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)

    [/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]
    • Offizieller Beitrag

    Würde das nicht besser sein wenn man das GUI nicht bewegen könnte o. steckt da absicht hinter?


    Das kann man natürlich nach seinem Geschmack anpassen.
    Ziel war eine Möglickeit zu schaffen, ähnlich wie bei Entwickleroberflächen, bedarfsweise Fenster mit z.B. Funktionsinfos o.ä. einblenden zu können.

  • Ahh Okay!

    Ich habe in dir richtung Outlook gedacht und mich schon des öfteren gefragt wie ich soetwas realisieren könnte!
    Jetzt habe ich schon mal ein ansatz!


    LG Kleiner

    • Offizieller Beitrag

    Ich finde das Beispiel gut, nur schade das der Slide Effekt bei WIndows 7 und Vista nicht funktioniert.

  • So was kann man auch mit Tabs machen, aber das sieht dan nicht so toll aus ;)

    Spoiler anzeigen
    [autoit]

    #include<GUITab.au3>
    $GUI = GUICreate("test", 400, 300)
    $Edit = GUICtrlCreateEdit("", 10, 10, 370, 280)
    $old = _EnableTheme(0)
    $tab = GUICtrlCreateTab(380, 0, 20, 300, BitOR($TCS_MULTILINE, $TCS_VERTICAL, $TCS_RIGHT, $TCS_RIGHTJUSTIFY ))
    _EnableTheme($old)
    $f_TabShown = False
    $hide = GUICtrlCreateTabItem("| hide")
    GUICtrlCreateTabItem("Tab 1")
    GUICtrlCreateList("Liste|mit|Einträgen", 190, 10, 170, 200)
    GUICtrlCreateTabItem("Tab 2")
    GUICtrlCreateTabItem("")
    GUISetState()

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

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $tab
    If GUICtrlRead($tab, 1) = $hide Then
    $pos = ControlGetPos($GUI, '', $tab)
    GUICtrlSetPos($tab, $pos[0]+$pos[2]-20, $pos[1], $pos[2]-$pos[2]+20, $pos[3])
    $f_TabShown=False

    $pos2 = ControlGetPos($GUI, '', $Edit)
    GUICtrlSetPos($Edit, $pos2[0], $pos2[1], $pos2[2]+$pos[2]-20, $pos2[3])

    ElseIf Not $f_TabShown Then
    $pos = ControlGetPos($GUI, '', $tab)
    $f_TabShown = True
    GUICtrlSetPos($tab, $pos[0]-200, $pos[1], $pos[2]+200, $pos[3])

    $pos2 = ControlGetPos($GUI, '', $Edit)
    GUICtrlSetPos($Edit, $pos2[0], $pos2[1], $pos2[2]-200, $pos2[3])
    EndIf
    EndSwitch
    WEnd

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

    Func _EnableTheme($new=0)
    ; Author: Prog@ndy
    Local $state = DllCall('uxtheme.dll', 'dword', 'GetThemeAppProperties')
    DllCall('uxtheme.dll', 'none', 'SetThemeAppProperties', 'dword', $new)
    If IsArray($state) Then Return $state[0]
    EndFunc

    [/autoit]