Tortendiagramm in einer transparenten GUI

  • hallo Gemeinde, 8|
    ich möchte ein Tortendiagramm auf dem Desktop darstellen
    [GUI unsichtbar (0%), Torte sichtbar (100%)]

    Bei meinem Versuch habe ich als Hintergrund immer noch ein graues Rechteck:

    P.S. Ich glaube, es liegt nicht an der GUI, sondern an GUICtrlCreateGraphic

    4 Mal editiert, zuletzt von bertizwo (29. April 2011 um 19:57)

    • Offizieller Beitrag

    Schau mal hier:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    ;#include <ProgressConstants.au3> ;$PBS_

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

    main()
    Func main()
    Local $msg, $i = 1
    CreatePie()
    Do
    $msg = GUIGetMsg()
    If $i < 0 Then Exit
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>main

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

    Func CreatePie()
    Local $HUD[10], $g
    $HUD[1] = GUICreate("HUD 1", 43, 52, 565, 90, $WS_POPUP, $WS_EX_LAYERED)
    GUISetBkColor(0xABCDEF)
    $g = GUICtrlCreateGraphic(20, 20, 20, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xffffff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, 90, -180)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff, 0xff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, -90, -180)
    _WinAPI_SetLayeredWindowAttributes($HUD[1], 0xABCDEF, 255)
    GUISetState()

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

    EndFunc ;==>CreatePie

    [/autoit]
  • Raupi ist der Beste... perfekt 8)

    Ich habe noch zwei Anliegen:
    1. Diagramm bei mehreren Fenstern immer im Vordergrund
    2. Wie realisiere ich das Verschieben des Diagramms mit der rechten Maustaste ?


    Vielen Dank :rock:

    • Offizieller Beitrag

    Zu 1: Den Ex-Style $WS_EX_TOPMOST verwenden.
    Zu 2: Den Ex-Style $WS_EX_CONTROLPARENT verwenden.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    ;#include <ProgressConstants.au3> ;$PBS_

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

    main()
    Func main()
    Local $msg, $i = 1
    CreatePie()
    Do
    $msg = GUIGetMsg()
    If $i < 0 Then Exit
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc ;==>main

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

    Func CreatePie()
    Local $HUD[10], $g
    $HUD[1] = GUICreate("HUD 1", 43, 52, 565, 90, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST, $WS_EX_CONTROLPARENT ))
    GUISetBkColor(0xABCDEF)
    $g = GUICtrlCreateGraphic(20, 20, 20, 20)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0, 0xffffff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, 90, -180)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff, 0xff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, -90, -180)
    _WinAPI_SetLayeredWindowAttributes($HUD[1], 0xABCDEF, 255)
    GUISetState()

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

    EndFunc ;==>CreatePie

    [/autoit]
  • 1. Dafür gibt es den erweiterten Fenster Stil $WS_EX_TOPMOST
    2.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $vUser32Dll = DllOpen("user32.dll")

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

    $hWnd = GUICreate("Test", 400, 400)
    GUISetState()

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWnd)
    GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_Drag", $hWnd)

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

    While Sleep(1000)
    WEnd

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

    Func _Exit()
    Exit
    EndFunc ;==>_Exit

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

    Func _Drag()
    $aMousePosWindow = GUIGetCursorInfo()
    While _IsPressed("02", $vUser32Dll) And Sleep(10)
    $aMousePosDesktop = MouseGetPos()
    WinMove($hWnd, "", $aMousePosDesktop[0] - $aMousePosWindow[0] - 3, $aMousePosDesktop[1] - $aMousePosWindow[1] - 23)
    WEnd
    EndFunc ;==>_Drag

    [/autoit]

    Edit: Raupi war schneller... Aber ich dachte er wollte das Fenster mit der rechten Maustaste verschieben? :huh:

    • Offizieller Beitrag
    Zitat von name22

    Aber ich dachte er wollte das Fenster mit der rechten Maustaste verschieben? :huh:

    Hab ich geflissentlich überlesen :D

    Warum gerade mit der rechten Maustaste ist mir sowieso schleierhaft. Die normalen Fenster verschiebt man auch mit der linken Maustaste.
    Was auch Sinn macht, da alle Controls/Fenster die rechte Maustaste für das Contexmenü benutzen.

  • raupi hat recht, gemeint war die linke Maustaste .... :whistling:


    Eine Aufgabe hab ich noch:
    - es gibt Probleme mit GUICtrlCreateLabel

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3> ;_WinApi_
    #include <WindowsConstants.au3> ;WS_
    #include <StaticConstants.au3> ;$SS_
    #Region - Timestamp
    ; 2011-04-29 17:11:47
    #EndRegion
    main()
    Func main()
    Local $msg, $i=1
    CreatePie()
    Do
    $msg = GUIGetMsg()
    If $i < 0 Then Exit
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc

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

    Func CreatePie($sum=0)
    local $HUD[10],$fond
    ;unsichtbare, im Vordergrund stehende und verschiebbare GUI
    $HUD[1] = GUICreate("HUD 1", 43, 52, 565, 90, $WS_POPUP, bitOr($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_CONTROLPARENT))
    GUISetBkColor(0xABCDEF)
    _WinAPI_SetLayeredWindowAttributes($HUD[1], 0xABCDEF,255)

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

    ;erstelle ein Tortendiagramm
    GUICtrlCreateGraphic(20, 20, 20, 20)

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

    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff, 0xffffff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, 90, -180)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff, 0xff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, -90,-180)

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

    ;Text in der Torte
    GUICtrlCreateLabel($sum, 15, 15)
    GUICtrlSetFont(-1, 9, 400, 1, "Tahoma")
    GUICtrlSetColor(-1,0xffffff)

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

    GUISetState()
    EndFunc ;==>CreatePie

    [/autoit]


    1) Es stört das kleine Rechteck mit dem Desktophintergrund.
    2) Wie treffe ich die genaue Mitte der Torte

    Einmal editiert, zuletzt von bertizwo (29. April 2011 um 20:15)

    • Offizieller Beitrag

    Hier ein Beispiel:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3> ;_WinApi_
    #include <WindowsConstants.au3> ;WS_
    #include <StaticConstants.au3> ;$SS_
    #Region - Timestamp
    ; 2011-04-29 20:34:02
    #EndRegion
    main()
    Func main()
    Local $msg, $i=1
    CreatePie()
    Do
    $msg = GUIGetMsg()
    If $i < 0 Then Exit
    Until $msg = $GUI_EVENT_CLOSE
    EndFunc

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

    Func CreatePie($sum=0)
    local $HUD[10],$fond
    ;unsichtbare, im Vordergrund stehende und verschiebbare GUI
    $HUD[1] = GUICreate("HUD 1", 43, 52, 565, 90, $WS_POPUP, bitOr($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_CONTROLPARENT))
    GUISetBkColor(0xABCDEF)
    _WinAPI_SetLayeredWindowAttributes($HUD[1], 0xABCDEF,255)

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

    ;erstelle ein Tortendiagramm
    GUICtrlCreateGraphic(20, 20, 20, 20)

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

    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xffffff, 0xffffff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, 90, -180)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff, 0xff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 10, -90,-180)

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

    ;Text in der Torte
    GUICtrlCreateLabel($sum, 15, 15)

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

    GUICtrlSetFont(-1, 9, 400, 1, "Tahoma")
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT ); Hitergrundfareb auf Transparent
    GUICtrlSetState(-1,$GUI_DISABLE); Control nicht anklickbar. Dadurch nimmt die Garfik den Klick an
    GUISetState()
    EndFunc ;==>CreatePie

    [/autoit]

    Das Problem ist dabei, das Label wird bei Verwendung eines LayerdWindows nicht in der Richtigen Farbe dargestellt. Mit fällt dazu keine Lösung ein.
    Generell werden die Label bei einem LayeredWindow schwammig dargestellt.

  • Das liegt daran, dass bei _WinAPI_SetLayeredWindowAttributes der Alpha Channel nicht beachtet wird. Man könnte es auch mit WinAPI_UpdateLayeredWindow machen, aber das ist ein wenig komplizierter. Vor allem wird Text dann immer noch eigenartig dargestellt, ich musste das ganze mit den Path Funktionen aus der GDIP.au3 machen damit der Text sauber gezeichnet wurde...

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIP.au3>
    #include <WinAPI.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", 300)
    DllStructSetData($tSize, "Y", 100)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $hWnd = GUICreate("Test", 300, 100, Default, Default, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
    GUISetState()

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

    $hDC_Window = _WinAPI_GetDC($hWnd)
    $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Window)
    $hGDI_Bitmap = _WinAPI_CreateCompatibleBitmap($hDC_Window, 300, 100)
    _WinAPI_SelectObject($hDC_Buffer, $hGDI_Bitmap)

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

    _GDIPlus_Startup()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

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

    $hBrush_Text = _GDIPlus_BrushCreateSolid(0xFFFF0000)

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

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI")
    $hFont = _GDIPlus_FontCreate($hFamily, 25)
    $tLayout = _GDIPlus_RectFCreate(5, 5)

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

    $hPath = _GDIPlus_PathCreate()

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWnd)

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

    _GDIPlus_PathAddString($hPath, "AutoIt Rocks!", $tLayout, $hFamily, 0, 50, $hFormat)
    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush_Text)

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

    ;~ _GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks!", $hFont, $tLayout, $hFormat, $hBrush_Text)

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

    _WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)

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

    While Sleep(1000)
    WEnd

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

    Func _Exit()
    _WinAPI_ReleaseDC($hWnd, $hDC_Window)
    _WinAPI_DeleteDC($hDC_Buffer)
    _WinAPI_DeleteObject($hGDI_Bitmap)

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

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BrushDispose($hBrush_Text)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_Shutdown()

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

    Exit
    EndFunc

    [/autoit]
  • name22: das stimmt nicht ganz!

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>
    #include <WinAPI.au3>

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

    Opt("GUIOnEventMode", 1)

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

    $tSize = DllStructCreate($tagSIZE)
    $pSize = DllStructGetPtr($tSize)
    DllStructSetData($tSize, "X", 300)
    DllStructSetData($tSize, "Y", 100)
    $tSource = DllStructCreate($tagPOINT)
    $pSource = DllStructGetPtr($tSource)
    $tBlend = DllStructCreate($tagBLENDFUNCTION)
    $pBlend = DllStructGetPtr($tBlend)
    DllStructSetData($tBlend, "Alpha", 255)
    DllStructSetData($tBlend, "Format", 1)
    $tPoint = DllStructCreate($tagPOINT)
    $pPoint = DllStructGetPtr($tPoint)
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)

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

    $hWnd = GUICreate("Test", 300, 100, Default, Default, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
    GUISetState()

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

    $hDC_Window = _WinAPI_GetDC($hWnd)
    $hDC_Buffer = _WinAPI_CreateCompatibleDC($hDC_Window)
    $hGDI_Bitmap = _WinAPI_CreateCompatibleBitmap($hDC_Window, 300, 100)
    _WinAPI_SelectObject($hDC_Buffer, $hGDI_Bitmap)

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

    _GDIPlus_Startup()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
    DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $hGraphics, "int", 4)

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

    $hBrush_Text = _GDIPlus_BrushCreateSolid(0xFFFF0000)

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

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI")
    $hFont = _GDIPlus_FontCreate($hFamily, 25)
    $tLayout = _GDIPlus_RectFCreate(5, 5)

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

    ;~ $hPath = _GDIPlus_PathCreate()

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

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWnd)

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

    ;~ _GDIPlus_PathAddString($hPath, "AutoIt Rocks!", $tLayout, $hFamily, 0, 50, $hFormat)
    ;~ _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush_Text)

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

    _GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks!", $hFont, $tLayout, $hFormat, $hBrush_Text)

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

    _WinAPI_UpdateLayeredWindow($hWnd, $hDC_Window, 0, $pSize, $hDC_Buffer, $pSource, 0, $pBlend, 2)

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

    While Sleep(1000)
    WEnd

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

    Func _Exit()
    _WinAPI_ReleaseDC($hWnd, $hDC_Window)
    _WinAPI_DeleteDC($hDC_Buffer)
    _WinAPI_DeleteObject($hGDI_Bitmap)

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

    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BrushDispose($hBrush_Text)
    ;~ _GDIPlus_PathDispose($hPath)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_Shutdown()

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

    Exit
    EndFunc

    [/autoit]

    Gruß,
    UEZ ;)

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Zitat

    Wie kommt man eigentlich an den Quelltext von GUICtrlCreateLabel ?


    Ähm gar nicht? Zumindest nicht legal, da das eine interne AutoIt Funktion ist. ;) Du kannst entweder den Entwickler ansprechen oder dich mit der Funktion

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GUICtrlEdit_Create
    ; Description ...: Create a Edit control
    ; Syntax.........: _GUICtrlEdit_Create($hWnd, $sText, $iX, $iY[, $iWidth = 150[, $iHeight = 150[, $iStyle = 0x003010C4[, $iExStyle = 0x00000200]]]])
    ; Parameters ....: $hWnd - Handle to parent or owner window
    ; $sText - Text to be displayed in the control
    ; $iX - Horizontal position of the control
    ; $iY - Vertical position of the control
    ; $iWidth - Control width
    ; $iHeight - Control height
    ; $iStyle - Control styles:
    ; |$ES_AUTOHSCROLL - Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line.
    ; |$ES_AUTOVSCROLL - Automatically scrolls text up one page when the user presses the ENTER key on the last line.
    ; |$ES_CENTER - Centers text in a edit control.
    ; |$ES_LEFT - Aligns text with the left margin.
    ; |$ES_LOWERCASE - Converts all characters to lowercase as they are typed into the edit control.
    ; |$ES_MULTILINE - Forced
    ; |$ES_NOHIDESEL - The selected text is inverted, even if the control does not have the focus.
    ; |$ES_NUMBER - Allows only digits to be entered into the edit control.
    ; |$ES_OEMCONVERT - Converts text entered in the edit control.
    ; |$ES_READONLY - Prevents the user from typing or editing text in the edit control.
    ; |$ES_RIGHT - Right-aligns text edit control.
    ; |$ES_UPPERCASE - Converts all characters to uppercase as they are typed into the edit control.
    ; |$ES_WANTRETURN - Specifies that a carriage return be inserted when the user presses the ENTER key.
    ; |$ES_PASSWORD - Displays an asterisk (*) for each character that is typed into the edit control
    ; -
    ; |Default: $ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL
    ; |Forced : WS_CHILD, $WS_VISIBLE, $WS_TABSTOP unless $ES_READONLY
    ; $iExStyle - Control extended style. These correspond to the standard $WS_EX_ constants.
    ; Return values .: Success - Handle to the Edit control
    ; Failure - 0
    ; Author ........: Gary Frost
    ; Modified.......:
    ; Remarks .......: This function is for Advanced users and for learning how the control works.
    ; Related .......: _GUICtrlEdit_Destroy
    ; Link ..........:
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func _GUICtrlEdit_Create($hWnd, $sText, $iX, $iY, $iWidth = 150, $iHeight = 150, $iStyle = 0x003010C4, $iExStyle = 0x00000200)
    If Not IsHWnd($hWnd) Then Return SetError(1, 0, 0) ; Invalid Window handle for _GUICtrlEdit_Create 1st parameter
    If Not IsString($sText) Then Return SetError(2, 0, 0) ; 2nd parameter not a string for _GUICtrlEdit_Create

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

    If $iWidth = -1 Then $iWidth = 150
    If $iHeight = -1 Then $iHeight = 150
    If $iStyle = -1 Then $iStyle = 0x003010C4
    If $iExStyle = -1 Then $iExStyle = 0x00000200

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

    If BitAND($iStyle, $ES_READONLY) = $ES_READONLY Then
    $iStyle = BitOR($__UDFGUICONSTANT_WS_CHILD, $__UDFGUICONSTANT_WS_VISIBLE, $iStyle)
    Else
    $iStyle = BitOR($__UDFGUICONSTANT_WS_CHILD, $__UDFGUICONSTANT_WS_VISIBLE, $__EDITCONSTANT_WS_TABSTOP, $iStyle)
    EndIf
    ;=========================================================================================================

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

    Local $nCtrlID = __UDF_GetNextGlobalID($hWnd)
    If @error Then Return SetError(@error, @extended, 0)

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

    Local $hEdit = _WinAPI_CreateWindowEx($iExStyle, $__EDITCONSTANT_ClassName, "", $iStyle, $iX, $iY, $iWidth, $iHeight, $hWnd, $nCtrlID)
    _SendMessage($hEdit, $__EDITCONSTANT_WM_SETFONT, _WinAPI_GetStockObject($__EDITCONSTANT_DEFAULT_GUI_FONT), True)
    _GUICtrlEdit_SetText($hEdit, $sText)
    _GUICtrlEdit_SetLimitText($hEdit, 0)
    Return $hEdit
    EndFunc ;==>_GUICtrlEdit_Create

    [/autoit]

    zufriedengeben, die dir auch ein paar Einblicke in den Aufbau eines GUI Controls gewährt.

  • Die klare Darstellung der Zahl im Diagramm ohne lästigen Schatten geht
    dank $SS_SIMPLE in GUICtrlCreateLabel 8o

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3> ;$GUI_
    #include <WinAPI.au3> ;_WinApi_
    #include <WindowsConstants.au3> ;$WS_
    #include <StaticConstants.au3> ;$SS_SIMPLE
    #Region - Timestamp
    ; 2011-04-30 16:23:02
    #EndRegion

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

    CreatePie(50)
    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

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

    Func CreatePie($sum=0)
    local $HUD[10],$fond
    ;unsichtbare, im Vordergrund stehende und verschiebbare GUI
    $HUD[1] = GUICreate("HUD 1", 43, 52, 565, 90, $WS_POPUP, bitOr($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_CONTROLPARENT))
    GUISetBkColor(0xABCDEF)
    _WinAPI_SetLayeredWindowAttributes($HUD[1], 0xABCDEF,255)

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

    ;erstelle Tortendiagramm
    GUICtrlCreateGraphic(20, 20, 20, 20) ;Layer
    ;Torte
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x009933, 0x009933)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 15, 90, -180)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xff, 0xff)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 0, 0, 15, -90,-180)
    ;Text in der Torte
    GUICtrlCreateLabel($sum, 14, 13.5,20,20,$SS_SIMPLE)
    GUICtrlSetFont(-1, 9, 400, 0, "Britannic Bold",5)
    GUICtrlSetColor(-1,0xFFFFFF) ;white

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

    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT ); Hitergrundfarbe auf Transparent
    GUICtrlSetState(-1 ,$GUI_DISABLE); Control nicht anklickbar. Dadurch nimmt die Grafik den Klick an

    GUISetState()
    EndFunc ;==>CreatePie

    [/autoit]


    Wie kann ich das Tortendiagramm sauberer Zeichnen?
    Richtig rund ist es ja nicht gerade.