Runder Button

  • @Jam

    wenn du schon so hohe Ansprüche an deine Programme stellst, dann musst du auch damit rechnen das die Funktionen und Programme auch an dich hohe Anforderungen stellen, in Form von Zeitaufwand, Komplexität etc.

    Nicht umsonst wird bei Systementwicklern/Programmierern eine hohe Kenntniss der Englischen Sprache vorrausgesetzt ;)

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • Hab vor einiger Zeit mal zum testen ein Codeproject-Beispiel übersetzt:

    Spoiler anzeigen
    [autoit]

    ;~ *******************************************************
    ; Example - Create an ownerdrawn/colored button
    ;http://www.codeproject.com/KB/buttons/roundbuttons.aspx
    ; *******************************************************

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

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>
    #include <Color.au3>
    #include <WinAPI.au3>
    Global $hGUI

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

    Example()

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

    Func Example()
    Local Const $BS_OWNERDRAW = 0x0000000B
    Local $nButton, $nButton2, $GUIMsg

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

    $hGUI = GUICreate("My Ownerdrawn Created Button", 300, 200)

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

    $nButton = GUICtrlCreateButton("&owner-"&@CRLF&"drawn" & @CRLF & "button", 80, 40, 60, 60)
    $rgn = DllCall("GDI32.dll", "hwnd", "CreateEllipticRgn", "int", 0, "int", 0, "int", 60, "int", 60)
    $ret = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", GUICtrlGetHandle($nButton), "hwnd", $rgn[0], "int", 0)
    GUICtrlSetStyle($nButton, BitOR($WS_TABSTOP, $BS_NOTIFY, $BS_OWNERDRAW, $BS_MULTILINE,$BS_ICON)) ; Set the ownerdrawn flag


    $nButtonDis = GUICtrlCreateButton("Disable", 30, 110, 90, 30)
    $nButtonEn = GUICtrlCreateButton("Enable", 110, 110, 90, 30)
    GUICtrlSetState($nButtonEn, $GUI_DISABLE)

    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    ; WM_DRAWITEM has to registered before showing GUI otherwise the initial drawing isn't done
    GUIRegisterMsg($WM_DRAWITEM, "MY_WM_DRAWITEM")

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

    GUISetState()


    ;~ MsgBox(0, '', $icon)
    ;~ _SendMessage(GUICtrlGetHandle($nButton),$WM_SETICON,1,$icon)

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

    While 1
    $GUIMsg = GUIGetMsg()

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

    Switch $GUIMsg
    Case $GUI_EVENT_CLOSE
    ExitLoop

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

    Case $nButton

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

    MsgBox(0, "Info", "Button pressed")

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

    Case $nButtonDis

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

    GUICtrlSetState($nButton, $GUI_DISABLE)
    GUICtrlSetState($nButtonDis, $GUI_DISABLE)
    GUICtrlSetState($nButtonEn, $GUI_ENABLE)
    Case $nButtonEn

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

    GUICtrlSetState($nButton, $GUI_ENABLE)
    GUICtrlSetState($nButtonDis, $GUI_ENABLE)
    GUICtrlSetState($nButtonEn, $GUI_DISABLE)
    EndSwitch
    WEnd
    EndFunc ;==>Example

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

    ; React on a button click
    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    $nNotifyCode = BitShift($wParam, 16)
    $nID = BitAND($wParam, 0x0000FFFF)
    $hCtrl = $lParam

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

    If $nID <> 2 And $nNotifyCode = 0 Then ; Check for IDCANCEL - 2
    ; Ownerdrawn buttons don't send something by pressing ENTER
    ; So IDOK - 1 comes up, now check for the control that has the current focus
    If $nID = 1 Then
    $hFocus = DllCall("user32.dll", "hwnd", "GetFocus")
    $nCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hFocus[0])
    PostButtonClick($hWnd, $nCtrlID[0])
    Else
    Return $GUI_RUNDEFMSG
    MsgBox(0, "MY_WM_COMMAND", "GUIHWnd" & @TAB & ":" & $hWnd & @LF & _
    "MsgID" & @TAB & ":" & $Msg & @LF & _
    "wParam" & @TAB & ":" & $wParam & @LF & _
    "lParam" & @TAB & ":" & $lParam & @LF & @LF & _
    "WM_COMMAND - Infos:" & @LF & _
    "-----------------------------" & @LF & _
    "Code" & @TAB & ":" & $nNotifyCode & @LF & _
    "CtrlID" & @TAB & ":" & $nID & @LF & _
    "CtrlHWnd" & @TAB & ":" & $hCtrl)
    EndIf
    Return 0 ; Only workout clicking on the button
    EndIf
    ; Proceed the default Autoit3 internal message commands.
    ; You also can complete let the line out.
    ; !!! But only 'Return' (without any value) will not proceed
    ; the default Autoit3-message in the future !!!
    Return $GUI_RUNDEFMSG
    EndFunc ;==>MY_WM_COMMAND

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

    ; RePost a WM_COMMAND message to a ctrl in a gui window
    Func PostButtonClick($hWnd, $nCtrlID)
    DllCall("user32.dll", "int", "PostMessage", _
    "hwnd", $hWnd, _
    "int", $WM_COMMAND, _
    "int", BitAND($nCtrlID, 0x0000FFFF), _
    "hwnd", GUICtrlGetHandle($nCtrlID))
    EndFunc ;==>PostButtonClick

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

    ; Draw the button
    Func MY_WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $stDrawItem = DllStructCreate("uint;uint;uint;uint;uint;hwnd;hwnd;int[4];ulong_ptr", $lParam)
    Local Const $ODT_BUTTON = 4

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

    $nCtlType = DllStructGetData($stDrawItem, 1)
    If $nCtlType = $ODT_BUTTON Then
    Local $nCtrlID = DllStructGetData($stDrawItem, 2)
    Local $nItemState = DllStructGetData($stDrawItem, 5)
    Local $hCtrl = DllStructGetData($stDrawItem, 6)
    Local $hDC = DllStructGetData($stDrawItem, 7)
    Local $nLeft = DllStructGetData($stDrawItem, 8, 1)
    Local $nTop = DllStructGetData($stDrawItem, 8, 2)
    Local $nRight = DllStructGetData($stDrawItem, 8, 3)
    Local $nBottom = DllStructGetData($stDrawItem, 8, 4)
    Local $sText = _WinAPI_GetWindowText($hCtrl);"Ownerdrawn Button"
    DrawButton($hWnd, $hCtrl, $hDC, $nLeft, $nTop, $nRight, $nBottom, $nItemState, $sText)
    $stDrawItem = 0
    Return 1
    EndIf

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

    $stDrawItem = 0
    Return $GUI_RUNDEFMSG ; Proceed the default Autoit3 internal message commands
    EndFunc ;==>MY_WM_DRAWITEM

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

    ;~ COLORREF GetColour(double dAngle, COLORREF crBright, COLORREF crDark)
    Func GetColour($dAngle, $crBright, $crDark)
    ;~ $crBright = _ColorConvert($crBright)
    ;~ $crDark = _ColorConvert($crDark)
    Local Const $Rad2Deg = 180.0 / 3.1415
    Local Const $LIGHT_SOURCE_ANGLE = -2.356 ;// -2.356 radians = -135 degrees, i.e. From top left

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

    ;~ ASSERT(dAngle > -3.1416 && dAngle < 3.1416);
    Local $dAngleDifference = $LIGHT_SOURCE_ANGLE - $dAngle;

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

    If ($dAngleDifference < -3.1415) Then
    $dAngleDifference = 6.293 + $dAngleDifference;
    ElseIf ($dAngleDifference > 3.1415) Then
    $dAngleDifference = 6.293 - $dAngleDifference;
    EndIf

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

    Local $Weight = 0.5 * (Cos($dAngleDifference) + 1.0);

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

    Local $Red = ($Weight * _ColorGetRed($crBright) + (1.0 - $Weight) * _ColorGetRed($crDark));
    Local $Green = ($Weight * _ColorGetGreen($crBright) + (1.0 - $Weight) * _ColorGetGreen($crDark));
    Local $Blue = ($Weight * _ColorGetBlue($crBright) + (1.0 - $Weight) * _ColorGetBlue($crDark));

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

    ;~ //TRACE("LightAngle = %0.0f, Angle = %3.0f, Diff = %3.0f, Weight = %0.2f, RGB %3d,%3d,%3d\n",
    ;~ // LIGHT_SOURCE_ANGLE*Rad2Deg, dAngle*Rad2Deg, dAngleDifference*Rad2Deg, Weight,Red,Green,Blue);
    ;~ Return _ColorConvert(BitOR(BitShift(BitAND($Red, 0xFF), -16), BitShift(BitAND($Green, 0xFF), -8), BitAND($Blue, 0xFF)))
    Return (BitOR(BitShift(BitAND($Red, 0xFF), -16), BitShift(BitAND($Green, 0xFF), -8), BitAND($Blue, 0xFF)))
    EndFunc ;==>GetColour

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

    Func _ColorConvert($nColor);RGB to BGR or BGR to RGB
    Return _
    BitOR(BitShift(BitAND($nColor, 0x000000FF), -16), _
    BitAND($nColor, 0x0000FF00), _
    BitShift(BitAND($nColor, 0x00FF0000), 16))
    EndFunc ;==>_ColorConvert

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

    ;~ Func DrawCircle(CDC* pDC, CPoint p, LONG lRadius, COLORREF crColour, BOOL bDashed)
    Func DrawCircle($DC, $px, $py, $lRadius, $crColour, $bDashed = False)

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

    Local Const $nDashLength = 1;
    Local $lError, $lXoffset, $lYoffset;
    Local $nDash = 0;
    Local $bDashOn = True;

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

    ;~ //Check to see that the coordinates are valid
    ;~ ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
    ;~ ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );

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

    ;~ //Set starting values
    $lXoffset = $lRadius;
    $lYoffset = 0;
    $lError = -$lRadius;
    Local $DLL = DllOpen("gdi32.dll")
    Do
    If ($bDashOn) Then
    ;~ pDC->SetPixelV(p.x + lXoffset, p.y + lYoffset, crColour);
    _SetPixelV($DC, $px + $lXoffset, $py + $lYoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x + lXoffset, p.y - lYoffset, crColour);
    _SetPixelV($DC, $px + $lXoffset, $py - $lYoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x + lYoffset, p.y + lXoffset, crColour);
    _SetPixelV($DC, $px + $lYoffset, $py + $lXoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x + lYoffset, p.y - lXoffset, crColour);
    _SetPixelV($DC, $px + $lYoffset, $py - $lXoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x - lYoffset, p.y + lXoffset, crColour);
    _SetPixelV($DC, $px - $lYoffset, $py + $lXoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x - lYoffset, p.y - lXoffset, crColour);
    _SetPixelV($DC, $px - $lYoffset, $py - $lXoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x - lXoffset, p.y + lYoffset, crColour);
    _SetPixelV($DC, $px - $lXoffset, $py + $lYoffset, $crColour, $DLL);
    ;~ pDC->SetPixelV(p.x - lXoffset, p.y - lYoffset, crColour);
    _SetPixelV($DC, $px - $lXoffset, $py - $lYoffset, $crColour, $DLL);
    EndIf

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

    ;~ //Advance the error term and the constant X axis step

    $lError += $lYoffset;
    $lYoffset += 1

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

    ;~ //Check to see if error term has overflowed
    $lError += $lYoffset
    If ($lError) >= 0 Then
    $lXoffset -= 1
    $lError -= $lXoffset * 2;
    EndIf

    $nDash += 1
    If ($bDashed And ($nDash == $nDashLength)) Then
    $nDash = 0;
    $bDashOn = Not $bDashOn;
    EndIf

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

    Until ($lYoffset > $lXoffset); //Continue until halfway point
    DllClose($DLL)
    EndFunc ;==>DrawCircle

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

    Func FillCircle($DC, $px, $py, $lRadius, $crBright, $crDark)
    Local $lError, $lXoffset, $lYoffset;

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

    ;~ //Check to see that the coordinates are valid
    ;~ ASSERT( (p.x + lRadius <= LONG_MAX) && (p.y + lRadius <= LONG_MAX) );
    ;~ ASSERT( (p.x - lRadius >= LONG_MIN) && (p.y - lRadius >= LONG_MIN) );

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

    ;~ //Set starting values
    $lXoffset = $lRadius;
    $lYoffset = 0;
    $lError = -$lRadius;
    Local Const $Pi = 3.141592654
    Local Const $Pi_on_2 = $Pi * 0.5
    Local Const $Three_Pi_on_2 = $Pi * 1.5;
    Local $crColour;
    Local $DLL = DllOpen("gdi32.dll")
    Do

    ;~ $dAngle = atan2($lYoffset, $lXoffset);
    $dAngle = ATan2($lXoffset, $lYoffset);

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

    ;~ //Draw the current pixel, reflected across all eight arcs
    $crColour = GetColour($dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px + $lXoffset, $py + $lYoffset, $crColour, $DLL);

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

    $crColour = GetColour($Pi_on_2 - $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px + $lYoffset, $py + $lXoffset, $crColour, $DLL);

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

    $crColour = GetColour($Pi_on_2 + $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px - $lYoffset, $py + $lXoffset, $crColour, $DLL);

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

    $crColour = GetColour($Pi - $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px - $lXoffset, $py + $lYoffset, $crColour, $DLL);

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

    $crColour = GetColour(-$Pi + $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px - $lXoffset, $py - $lYoffset, $crColour, $DLL);

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

    $crColour = GetColour(-$Pi_on_2 - $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px - $lYoffset, $py - $lXoffset, $crColour, $DLL);

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

    $crColour = GetColour(-$Pi_on_2 + $dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px + $lYoffset, $py - $lXoffset, $crColour, $DLL);

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

    $crColour = GetColour(-$dAngle, $crBright, $crDark);
    _SetPixelV($DC, $px + $lXoffset, $py - $lYoffset, $crColour, $DLL);

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

    ;~ //Advance the error term and the constant X axis step

    $lError += $lYoffset
    $lYoffset += 1

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

    ;~ //Check to see if error term has overflowed
    $lError += $lYoffset
    If ($lError >= 0) Then
    $lXoffset -= 1
    $lError -= $lXoffset * 2;
    EndIf

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

    Until ($lYoffset > $lXoffset); //Continue until halfway point
    DllClose($DLL)
    EndFunc ;==>FillCircle

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

    Func _SetPixelV($hDC, $x, $y, $color, $DLL = "gdi32.dll")
    $setpixel = DllCall($DLL, "long", "SetPixelV", "long", $hDC, "long", $x, "long", $y, "long", $color)
    EndFunc ;==>_SetPixelV

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

    Func ATan2($x, $y)
    Local Const $Pi = 3.14159265358979
    If $y < 0 Then
    Return -ATan2($x, -$y)
    ElseIf $x < 0 Then
    Return $Pi - ATan(-$y / $x)
    ElseIf $x > 0 Then
    Return ATan($y / $x)
    ElseIf $y <> 0 Then
    Return $Pi / 2
    Else
    ;~ MsgBox( 16, "Error - Division by zero", "Domain Error in Function: ATan2()" & @LF & "$x and $y cannot both equal zero" )
    SetError(1)
    EndIf
    EndFunc ;==>ATan2
    Func _GetStockObject($obj)
    Local $nSavedDC = DllCall("gdi32.dll", "int", "GetStockObject", "hwnd", $obj)
    Return $nSavedDC[0]
    EndFunc ;==>_GetStockObject
    ; The main drawing procedure
    Func DrawButton($hWnd, $hCtrl, $hDC, $nLeft, $nTop, $nRight, $nBottom, $nItemState, $sText)
    ;Local $bDefault = FALSE
    Local Const $GWL_STYLE = -16
    Local Const $ODS_SELECTED = 0x0001
    Local Const $ODS_GRAYED = 0x0002
    Local Const $ODS_DISABLED = 0x0004
    Local Const $ODS_CHECKED = 0x0008
    Local Const $ODS_FOCUS = 0x0010
    Local Const $ODS_HOTLIGHT = 0x0040
    Local Const $ODS_INACTIVE = 0x0080
    Local Const $ODS_NOACCEL = 0x0100
    Local Const $ODS_NOFOCUSRECT = 0x0200
    Local Const $DFC_BUTTON = 4
    Local Const $DFCS_BUTTONPUSH = 0x0010

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

    Local $bChecked = BitAND($nItemState, $ODS_CHECKED)
    Local $bFocused = BitAND($nItemState, $ODS_FOCUS)
    Local $bGrayed = BitAND($nItemState, $ODS_DISABLED) Or BitAND($nItemState, $ODS_GRAYED)
    Local $bSelected = BitAND($nItemState, $ODS_SELECTED)
    Local $bMouseOver = BitAND($nItemState, $ODS_HOTLIGHT)
    Local $bNoFocusRect = BitAND($nItemState, $ODS_NOFOCUSRECT)
    Local $bNoAccel = BitAND($nItemState, $ODS_NOACCEL)

    Local $ButtonStyle = _WinAPI_GetWindowLong($hCtrl, $GWL_STYLE)
    Local $bStyleFlat = BitAND($ButtonStyle, $BS_FLAT)
    Local $bDefPushButton = BitAND($ButtonStyle, $BS_DEFPUSHBUTTON)
    Local $bMultLine = BitAND($ButtonStyle, $BS_MULTILINE)
    Local $bIcon = BitAND($ButtonStyle, $BS_ICON)

    Local $m_ptCentreX = Int($nLeft + ($nRight - $nLeft) / 2) - 1
    Local $m_ptCentreY = Int($nTop + ($nBottom - $nTop) / 2) - 1
    Local $nRadius = $m_ptCentreX - $nLeft
    ;~ ConsoleWrite($nRadius & @CRLF)
    $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)
    ;~ CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    ;~ CRect rect = lpDrawItemStruct->rcItem;
    ;~ UINT state = lpDrawItemStruct->itemState;
    ;~ UINT nStyle = GetStyle();
    ;~ int nRadius = m_nRadius;

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

    ;~ int nSavedDC = pDC->SaveDC();
    Local $nSavedDC = DllCall("gdi32.dll", "int", "SaveDC", "hwnd", $hDC)
    $nSavedDC = $nSavedDC[0]

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

    Local $rgn = DllCall("GDI32.dll", "hwnd", "CreateEllipticRgn", "int", $nLeft-1, "int", $nTop-1, "int", $nRight+1, "int", $nBottom+1)
    ;~ rgn.CreateEllipticRgn(m_ptCentre.x-nRadius, m_ptCentre.y-nRadius,
    ;~ m_ptCentre.x+nRadius, m_ptCentre.y+nRadius);
    ;~ pDC->SelectClipRgn(&rgn);
    DllCall("gdi32.dll", "int", "SelectClipRgn", "hwnd", $hDC, "hwnd", $rgn[0])
    _WinAPI_DeleteObject($rgn[0])

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

    ;~ pDC->SelectStockObject(NULL_BRUSH);

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

    _WinAPI_SelectObject($hDC, _GetStockObject(5))
    ;~ Local $hBrush = _WinAPI_GetSysColorBrush(15)
    If $bGrayed Then
    Local $hBrush = _WinAPI_CreateSolidBrush(_WinAPI_GetSysColor($COLOR_3DLIGHT) - 0x090909)
    Else
    Local $hBrush = _WinAPI_CreateSolidBrush(_WinAPI_GetSysColor($COLOR_BTNFACE) - 0x090909)
    EndIf
    _WinAPI_FillRect($hDC, DllStructGetPtr($stRect), $hBrush)
    _WinAPI_DeleteObject($hBrush)

    ;~ Ellipse($HDC,$nLeft,$nTop,$nRight,$nBottom,_WinAPI_GetSysColorBrush(15),_GetStockObject(8))
    ;~ pDC->FillSolidRect(rect, ::GetSysColor(COLOR_BTNFACE));

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

    ;~ // Draw the focus circle around the button
    ;~ if ((state & ODS_FOCUS) && m_bDrawDashedFocusCircle)
    Local $dottedCol = _WinAPI_GetSysColor(15)
    If $bFocused And Not $bNoFocusRect Then $dottedCol = 0
    If Not $bStyleFlat Then
    DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, $dottedCol, 0);
    $nRadius -= 1
    EndIf

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

    ;~ // Draw the raised/sunken edges of the button (unless flat)
    If $bStyleFlat Then
    DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, 0);
    $nRadius -= 1
    DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, _WinAPI_GetSysColor($COLOR_3DHIGHLIGHT));
    $nRadius -= 1
    Else
    If ($bSelected) Then
    FillCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, _
    GetSysColor($COLOR_3DDKSHADOW), GetSysColor($COLOR_3DHIGHLIGHT));
    $nRadius -= 1
    FillCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, _
    GetSysColor($COLOR_3DSHADOW), GetSysColor($COLOR_3DLIGHT));
    $nRadius -= 1
    Else
    FillCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, _
    GetSysColor($COLOR_3DHIGHLIGHT), GetSysColor($COLOR_3DDKSHADOW));
    $nRadius -= 1
    FillCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius, _
    GetSysColor($COLOR_3DLIGHT), GetSysColor($COLOR_3DSHADOW));
    $nRadius -= 1
    EndIf
    EndIf

    ;~ // draw the text if there is any
    ;~ Local $strText = _winapi_GetWindowText($hCtrl);

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

    If (StringLen($sText)) Then
    Local $rgn = DllCall("GDI32.dll", "hwnd", "CreateEllipticRgn", "int", $nLeft + 3, "int", $nTop + 3, "int", $nRight - 3, "int", $nBottom - 3)
    ;~ rgn.CreateEllipticRgn(m_ptCentre.x-nRadius, m_ptCentre.y-nRadius,
    ;~ m_ptCentre.x+nRadius, m_ptCentre.y+nRadius);
    ;~ pDC->SelectClipRgn(&rgn);
    DllCall("gdi32.dll", "int", "SelectClipRgn", "hwnd", $hDC, "hwnd", $rgn[0])
    _WinAPI_DeleteObject($rgn[0])
    Local $extend = _WinAPI_GetTextExtentPoint32($hDC, $sText)
    ;~ CSize Extent = pDC->GetTextExtent(strText);
    ;~ CPoint pt = CPoint( m_ptCentre.x - Extent.cx/2, m_ptCentre.x - Extent.cy/2 );

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

    ;~ if ($bSelected) pt.Offset(1,1);

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

    ;~ pDC->SetBkMode(TRANSPARENT);
    DllCall("gdi32.dll", "int", "SetBkMode", "hwnd", $hDC, "int", 1)
    Local $DST_PREFIXTEXT = 2
    Local $DSS_DISABLED = 0x20
    Local $DSS_HIDEPREFIX = 0x200
    If $bMultLine Then
    Local $tRect = DllStructCreate($tagRect)
    _WinAPI_DrawText($hDC,$sText,$tRect,BitOR($DT_CENTER, $DT_VCENTER,$DT_CALCRECT))

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

    If ($bGrayed) Then
    ;~ pDC->DrawState(pt, Extent, strText, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
    SetTextColor($hDC, GetSysColor($COLOR_GRAYTEXT))
    EndIf
    $nLeft = $m_ptCentreX - DllStructGetData($tRect, 3) / 2 + $bSelected
    $nTop = $m_ptCentreY - DllStructGetData($tRect, 4) / 2 + $bSelected
    DrawText($hDC, $sText, $nLeft, $nTop, _
    DllStructGetData($tRect, 3)+$nLeft, DllStructGetData($tRect, 4)+$nTop, BitOR($DT_CENTER, $DT_VCENTER))

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

    Else
    _DrawState($hDC, 0, 0, $sText, StringLen($sText), $m_ptCentreX - DllStructGetData($extend, 1) / 2 + $bSelected, $m_ptCentreY - DllStructGetData($extend, 2) / 2 + $bSelected, _
    DllStructGetData($extend, 1), DllStructGetData($extend, 2), $DST_PREFIXTEXT + $DSS_DISABLED * $bGrayed + $DSS_HIDEPREFIX * $bNoAccel, "str", "int")
    EndIf
    If $bIcon Then
    Local $icon = _SendMessage($hCtrl,$WM_GETICON,1,0)
    If $icon Then
    _WinAPI_DrawIcon($hDC,$m_ptCentreX-16,$m_ptCentreY-16,$icon)
    _WinAPI_DestroyIcon($icon)
    EndIf
    EndIf
    ;~ if ($bGrayed) Then
    ;~ pDC->DrawState(pt, Extent, strText, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
    ;~ SetTextColor($hDC, GetSysColor($COLOR_GRAYTEXT))
    ;~ EndIf
    ;~ else
    ;~ DrawText($HDC, $sText,$nLeft,$nTop,$nRight,$nBottom,BitOR($DT_CENTER, $DT_VCENTER))
    ;~ EndIf
    ;~ pDC->SelectClipRgn(NULL);

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

    ;~ rgn.DeleteObject();
    EndIf

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

    ;~ // Draw the focus circle on the inside of the button
    If $bStyleFlat Then
    If ($bFocused) And Not $bNoFocusRect Then DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius - 1, $dottedCol, True);
    Else
    If ($bFocused) And Not $bNoFocusRect Then ; And $m_bDrawDashedFocusCircle)
    DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius - 2, $dottedCol, True);
    Else
    DrawCircle($hDC, $m_ptCentreX, $m_ptCentreY, $nRadius - 2, _WinAPI_GetSysColor(15) - 0x202020, False);
    EndIf
    EndIf
    DllCall("gdi32.dll", "int", "SelectClipRgn", "hwnd", $hDC, "hwnd", 0)
    ;~ pDC->RestoreDC(nSavedDC);
    DllCall("gdi32.dll", "int", "RestoreDC", "hwnd", $hDC, "int", $nSavedDC)

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

    Return 1
    EndFunc ;==>DrawButton

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

    Func _DrawState($hDC, $hBrush, $lpOutPutFunc, $lData, $wData, $x, $y, $cx, $cy, $fuFlags, $lDataType = "lparam", $wDataType = "wparam")
    ;~ HDC hdc, // handle to device context
    ;~ HBRUSH hbr, // handle to brush
    ;~ DRAWSTATEPROC lpOutputFunc, // callback function
    ;~ LPARAM lData, // image information
    ;~ WPARAM wData, // more image information
    ;~ int x, // horizontal location
    ;~ int y, // vertical location
    ;~ int cx, // image width
    ;~ int cy, // image height
    ;~ UINT fuFlags // image type and state
    Local $Return = DllCall("user32.dll", "int", "DrawState", "hwnd", $hDC, "hwnd", $hBrush, "ptr", $lpOutPutFunc, $lDataType, $lData, $wDataType, $wData, "int", $x, "int", $y, "int", $cx, "int", $cy, "uint", $fuFlags)
    Return $Return[0]
    EndFunc ;==>_DrawState

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

    ; Some graphic / windows functions
    Func CreateSolidBrush($nColor)
    Local $hBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $nColor)
    Return $hBrush[0]
    EndFunc ;==>CreateSolidBrush

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

    Func GetSysColor($nIndex)
    Local $nColor = DllCall("user32.dll", "int", "GetSysColor", "int", $nIndex)
    Return $nColor[0]
    EndFunc ;==>GetSysColor

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

    Func GetSysColorBrush($nIndex)
    Local $hBrush = DllCall("user32.dll", "hwnd", "GetSysColorBrush", "int", $nIndex)
    Return $hBrush[0]
    EndFunc ;==>GetSysColorBrush

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

    Func DrawFrameControl($hDC, $nLeft, $nTop, $nRight, $nBottom, $nType, $nState)
    Local $stRect = DllStructCreate("int;int;int;int")

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

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    DllCall("user32.dll", "int", "DrawFrameControl", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "int", $nType, "int", $nState)

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

    $stRect = 0
    EndFunc ;==>DrawFrameControl

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

    Func DrawFocusRect($hDC, $nLeft, $nTop, $nRight, $nBottom)
    Local $stRect = DllStructCreate("int;int;int;int")

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

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    DllCall("user32.dll", "int", "DrawFocusRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect))

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

    $stRect = 0
    EndFunc ;==>DrawFocusRect

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

    Func DrawText($hDC, $sText, $nLeft, $nTop, $nRight, $nBottom, $nFormat)
    Local $nLen = StringLen($sText)

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

    Local $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    Local $stText = DllStructCreate("char[260]")
    DllStructSetData($stText, 1, $sText)

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

    DllCall("user32.dll", "int", "DrawText", "hwnd", $hDC, "ptr", DllStructGetPtr($stText), "int", $nLen, "ptr", DllStructGetPtr($stRect), "int", $nFormat)

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

    $stRect = 0
    $stText = 0
    EndFunc ;==>DrawText

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

    Func FillRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")

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

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    DllCall("user32.dll", "int", "FillRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)

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

    $stRect = 0
    EndFunc ;==>FillRect
    Func Ellipse($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush, $hPen)
    Local $OldBrush = SelectObject($hDC, $hBrush)
    Local $OldPen = SelectObject($hDC, $hPen)

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

    $ret = DllCall("gdi32.dll", "int", "Ellipse", "hwnd", $hDC, "int", $nLeft, "int", $nTop, "int", $nRight, "int", $nBottom)
    SelectObject($hDC, $OldPen)
    EndFunc ;==>Ellipse

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

    Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")

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

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)

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

    $stRect = 0
    EndFunc ;==>FrameRect

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

    Func InflateRect(ByRef $nLeft, ByRef $nTop, ByRef $nRight, ByRef $nBottom, $nX, $nY)
    Local $stRect = DllStructCreate("int;int;int;int")

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

    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)

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

    DllCall("user32.dll", "int", "InflateRect", "ptr", DllStructGetPtr($stRect), "int", $nX, "int", $nY)

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

    $nLeft = DllStructGetData($stRect, 1)
    $nTop = DllStructGetData($stRect, 2)
    $nRight = DllStructGetData($stRect, 3)
    $nBottom = DllStructGetData($stRect, 4)

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

    $stRect = 0
    EndFunc ;==>InflateRect

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

    Func SetBkColor($hDC, $nColor)
    Local $nOldColor = DllCall("gdi32.dll", "int", "SetBkColor", "hwnd", $hDC, "int", $nColor)
    Return $nOldColor[0]
    EndFunc ;==>SetBkColor

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

    Func SetTextColor($hDC, $nColor)
    Local $nOldColor = DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $hDC, "int", $nColor)
    Return $nOldColor[0]
    EndFunc ;==>SetTextColor

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

    Func SelectObject($hDC, $hObj)
    Local $hOldObj = DllCall("gdi32.dll", "hwnd", "SelectObject", "hwnd", $hDC, "hwnd", $hObj)
    Return $hOldObj[0]
    EndFunc ;==>SelectObject

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

    Func DeleteObject($hObj)
    Local $nResult = DllCall("gdi32.dll", "hwnd", "DeleteObject", "hwnd", $hObj)
    EndFunc ;==>DeleteObject

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

    Func GetWindowLong($hWnd, $nIndex)
    Local $nVal = DllCall("user32.dll", "int", "GetWindowLong", "hwnd", $hWnd, "int", $nIndex)
    Return $nVal[0]
    EndFunc ;==>GetWindowLong

    [/autoit]
  • @progandy
    Oh, hab garnicht gemerkt das du was gepostet hast!
    Das fuck ich mir gleich mal an!


    So, man hat mir im Englischen forum geholfen!
    Da hab ich jetzt nur noch ein Problem!

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    $hWin = GUICreate("Test", 200, 200)
    GUISetBkColor(0x00FF00, $hWin)

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

    $hPic = GUICtrlCreatePic("button.gif", 90, 90, 21, 21)

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

    GUISetState()

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

    While 1

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

    $iMsg = GUIGetMsg()

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

    Switch $iMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $hPic
    $iOldOpt = Opt("MouseCoordMode", 2)
    $aPos = MouseGetPos()
    If _PointInEllipse($aPos[0], $aPos[1], 90, 90, 21, 21) Then MsgBox(0, "", "Hit")
    Opt("MouseCoordMode", $iOldOpt)
    EndSwitch

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

    WEnd

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

    Func _PointInEllipse($xPt, $yPt, $xTL, $yTL, $w, $h)
    Local $bInside = False, $a = $w / 2, $b = $h / 2
    Local $c1X, $c2X, $dist, $xc = $xTL + $a, $yc = $yTL + $b
    $c1X = $xc - ($a ^ 2 - $b ^ 2) ^ (1 / 2); 1st focal point x position
    $c2X = $xc + ($a ^ 2 - $b ^ 2) ^ (1 / 2); 2nd focal point x position
    $dist = (($xPt - $c1X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5 + (($xPt - $c2X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5
    If $dist <= $w Then $bInside = Not $bInside
    Return $bInside
    EndFunc ;==>_PointInEllipse

    [/autoit]


    Wie bekomme ich das Pic transparent? Also das bild vom Button ist transparent, aner bei mir zeigt er das nicht an :(

    mfg. Jam00

  • Das bild ist aus dem Englischen Forum, bei dem Geht es uach, denn da hab ich auch gefragt, woran das liegen könnte, und der hat das Bild hochgeladen!

    EDIT:
    Das hat der Programierer gerad dazu gesagt:
    But it is transparent for me! I presume you are using XP while I am on Vista - perhaps that is the difference. Can you get hold of any other .gifs with a transparent background to try? Perhaps mine did not travel well (joke!).

    EDIT2:
    @progandy
    Dein script ist auch gut!! Vor allem weil man damit auch Button rund bekommt! Allerdings ist für das was ich bruache Pic besser, deswegen nehme ich das aus dem Englischen Forum!

    mfg. Jam00

    Einmal editiert, zuletzt von Jam00 (5. Februar 2009 um 16:12)

  • Das fuck ich mir gleich mal an!
    So, man hat mir im Englischen forum geholfen!

    1. geiler rechtschreibfehler :rofl: :rofl: :rofl:
    2. ich dachte du kannst net so gut englisch :P
    im autoit ordner bei den examples gib es ein beispiel mit png
    schaus dir mal an
    und warum muss die gui denn so hässlich grün sein :D

    Padmak

  • @Padmak
    upsa :whistling:
    Ne, ich kann nicht gut englisch, aber die, hab es einfach auf deutsch geschreiben und dann per Google übersetzt ^^ Die haben kapiert was ich meine!
    Und die Gui ist nur ein Test :evil:

    EDIT:
    Hab jetzt einfach per Ico gemacht:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>

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

    $hWin = GUICreate("Test", 200, 200)
    GUISetBkColor(0x00FF00, $hWin)

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

    $hPic = GUICtrlCreateIcon("button.ico",0, 90, 90, 35, 35)

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

    GUISetState()

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

    While 1

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

    $iMsg = GUIGetMsg()

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

    Switch $iMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $hPic
    $iOldOpt = Opt("MouseCoordMode", 2)
    $aPos = MouseGetPos()
    If _PointInEllipse($aPos[0], $aPos[1], 90, 90, 21, 21) Then MsgBox(0, "", "Hit")
    Opt("MouseCoordMode", $iOldOpt)
    EndSwitch

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

    WEnd

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

    Func _PointInEllipse($xPt, $yPt, $xTL, $yTL, $w, $h)
    Local $bInside = False, $a = $w / 2, $b = $h / 2
    Local $c1X, $c2X, $dist, $xc = $xTL + $a, $yc = $yTL + $b
    $c1X = $xc - ($a ^ 2 - $b ^ 2) ^ (1 / 2); 1st focal point x position
    $c2X = $xc + ($a ^ 2 - $b ^ 2) ^ (1 / 2); 2nd focal point x position
    $dist = (($xPt - $c1X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5 + (($xPt - $c2X) ^ 2 + ($yPt - $yc) ^ 2) ^ 0.5
    If $dist <= $w Then $bInside = Not $bInside
    Return $bInside
    EndFunc ;==>_PointInEllipse

    [/autoit]

    mfg. Jam00

    Einmal editiert, zuletzt von Jam00 (5. Februar 2009 um 16:20)

  • oha in welcher klasse bist du denn wenn du net mal sowas fragen kannst :D
    jaja auf den icon hätte man auch selbst kommen können :D

    Padmak

  • Auch wenn man es hier im Forum irgendwo findet muss ich zugeben ich habe es über die hilfe auch nicht gefunden
    aber ich habe noch einen alten script von mir gefunden mit dem passenden code ich poste ihn dir mal damit sollte es gehen ist ne Beispiel gui


    Spoiler anzeigen
    [autoit]

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

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 377, 442, 377, 192,$WS_POPUP)
    _GuiRoundCorners($Form1, 0, 0, 65, 65)
    $Button1 = GUICtrlCreateButton("XXXXXXX", 160, 152, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("XXXXXXX", 128, 296, 75, 25, 0)
    $Button3 = GUICtrlCreateButton("XXXXXXX", 72, 80, 75, 25, 0)
    $Button4 = GUICtrlCreateButton("XXXXXXX", 288, 56, 75, 25, 0)
    $Button5 = GUICtrlCreateButton("X", 344, 416, 27, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _e ()
    Case $Button2
    _e ()
    Case $Button3
    _e ()
    Case $Button4
    _e ()
    Case $Button5
    _e ()
    EndSwitch
    WEnd

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

    Func _e ()
    Exit
    EndFunc

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

    Func _GuiRoundCorners($hWnd, $x1, $y1, $x3, $y3)
    Dim $pos, $ret, $ret2
    $pos = WinGetPos($hWnd)
    $ret = DllCall('gdi32.dll', 'long', 'CreateRoundRectRgn', _
    'long', $x1, _
    'long', $y1, _
    'long', $pos[2], _
    'long', $pos[3], _
    'long', $x3, _
    'long', $y3)
    If $ret[0] Then
    $ret2 = DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $hWnd, 'long', $ret[0], 'int', 1)
    If $ret2[0] Then
    Return 1
    Else
    Return 0
    EndIf
    Else
    Return 0
    EndIf
    EndFunc

    [/autoit]


    Mfg Eistee


    Edit : habe grade erst gesehen das oben auch ein Beispiel ist bin wohl zu spät xD ^^

  • Ich hab jetzt noch ein Problem:
    Ich hab es jetzt mit Icon gemacht, aber da hab ich das Problem, das dass Pic da wo es transparent ist die Hintergrundfarbe zeigt, ich brauche aber das er das Pic zeigt was darunter ist!
    Ich habe mal Probier das Pic was darunter ist erst zu erstellen, und das ging nicht, dann hab ich Probiert es danch zu erstellen, aber das hat auch nicht fucktionier!
    Ich mache es mal in den Dateianhang!
    THX an alle :thumbup:

    mfg. Jam00

  • bei mir zeigt er bloß wieder die 2 icons an, ohne hintergrundbild und mit so weißen ecken...

    Padmak

  • Oh, ich hab einen Pfad falsch angegeben!
    Du musst in Zeile 10 einfach beim Pfad noch \Data hinzufügen, hab es jetzt auch bei dem Link in Post33 auch aktualieseirt (Code und Rar)

    EDIT:
    Da ist noch ein Problem, manchmal auch wenn ich nichts anklicke führt er einen Button direckt nach dem Start aus, weiß jemand warum?

    mfg. Jam00