- 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
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
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
_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)
$aChild[0] = GUICreate("Child 1", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
$WS_CAPTION, $WS_EX_MDICHILD, $guiMain)
$aChild[1] = GUICreate("Child 2", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
$WS_CAPTION, $WS_EX_MDICHILD, $guiMain)
$aChild[2] = GUICreate("Child 3", $iWChild, $iHChild-$iWBorder, $iWMain-$iWChild-$iWBorder-21, -21, _
$WS_CAPTION, $WS_EX_MDICHILD, $guiMain)
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)
While 1
Sleep(100)
WEnd
Func _ende()
Exit
EndFunc
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
Func _hide()
Local $hWnd = @GUI_WinHandle
If $closehWnd Then
$hWnd = $closehWnd
$closehWnd = 0
EndIf
Return _slideOut($hWnd)
EndFunc
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
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
Func AnimateWindow($hWnd, $dwFlags, $dwTime=100)
DllCall("user32", 'long', 'AnimateWindow', 'hwnd', $hWnd, 'long', $dwTime, 'long', $dwFlags)
EndFunc
; #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
; 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
$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"))
;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
;Rotation Matrix
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixRotate($hMatrix, $iAngle, 1)
_GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)
;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)
;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)
$hBrush = _GDIPlus_BrushCreateSolid($iARGB)
$tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight)
_GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush)
; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)
$tLayout = ""
Return 1
EndFunc ;==>GDIPlus_SetAngledText