GDI+ Abgerundetes Rechteck

  • Ich glaube jemand hat hier im Forum schon mal eine Funktion dafür geschrieben... Aber da ich sie nicht mehr finden konnte und nicht weiß ob andere die die Funktion benötigen aber nicht finden können, habe ich mir meine eigene sehr gute Funktion für abgerundete Rechtecke geschrieben. :D Es gibt 2 Versionen, eine als _PathAdd... Funktion für GDIP Benutzer und eine als normales _GraphicsDraw/Fill.

    Abgerundetes Rechteck
    [autoit]

    ;Author: name22 (autoit.de)
    Func _GDIPlus_PathAddRoundRect($hPath, $nX, $nY, $nWidth, $nHeight, $nRadius)
    $hPathAddTmp = _GDIPlus_PathCreate()
    _GDIPlus_PathAddArc($hPathAddTmp, $nX, $nY, $nRadius * 2, $nRadius * 2, -180, 90)
    _GDIPlus_PathAddLine($hPathAddTmp, $nX + $nRadius, $nY, $nX + $nWidth - $nRadius, $nY)
    _GDIPlus_PathAddArc($hPathAddTmp, $nX + $nWidth - $nRadius * 2, $nY, $nRadius * 2, $nRadius * 2, -90, 90)
    _GDIPlus_PathAddLine($hPathAddTmp, $nX + $nWidth, $nY + $nRadius, $nX + $nWidth, $nY + $nHeight - $nRadius)
    _GDIPlus_PathAddArc($hPathAddTmp, $nX + $nWidth - $nRadius * 2, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 0, 90)
    _GDIPlus_PathAddLine($hPathAddTmp, $nX + $nRadius, $nY + $nHeight, $nX + $nWidth - $nRadius, $nY + $nHeight)
    _GDIPlus_PathAddArc($hPathAddTmp, $nX, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 90, 90)
    _GDIPlus_PathAddLine($hPathAddTmp, $nX, $nY + $nHeight - $nRadius, $nX, $nY + $nRadius)
    _GDIPlus_PathAddPath($hPath, $hPathAddTmp, False)
    EndFunc

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

    Func _GDIPlus_GraphicsDrawRoundRect($hGraphics, $nX, $nY, $nWidth, $nHeight, $nRadius, $hPen = 0)
    _GDIPlus_GraphicsDrawArc($hGraphics, $nX, $nY, $nRadius * 2, $nRadius * 2, -180, 90, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphics, $nX + $nRadius, $nY, $nX + $nWidth - $nRadius, $nY, $hPen)
    _GDIPlus_GraphicsDrawArc($hGraphics, $nX + $nWidth - $nRadius * 2, $nY, $nRadius * 2, $nRadius * 2, -90, 90, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphics, $nX + $nWidth, $nY + $nRadius, $nX + $nWidth, $nY + $nHeight - $nRadius, $hPen)
    _GDIPlus_GraphicsDrawArc($hGraphics, $nX + $nWidth - $nRadius * 2, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 0, 90, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphics, $nX + $nRadius, $nY + $nHeight, $nX + $nWidth - $nRadius, $nY + $nHeight, $hPen)
    _GDIPlus_GraphicsDrawArc($hGraphics, $nX, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 90, 90, $hPen)
    _GDIPlus_GraphicsDrawLine($hGraphics, $nX, $nY + $nHeight - $nRadius, $nX, $nY + $nRadius, $hPen)
    EndFunc

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

    Func _GDIPlus_GraphicsFillRoundRect($hGraphics, $nX, $nY, $nWidth, $nHeight, $nRadius, $hBrush = 0)
    _GDIPlus_GraphicsFillPie($hGraphics, $nX, $nY, $nRadius * 2, $nRadius * 2, -180, 90, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $nX + $nRadius - 1, $nY, $nWidth - $nRadius * 2 + 2, $nRadius, $hBrush)
    _GDIPlus_GraphicsFillPie($hGraphics, $nX + $nWidth - $nRadius * 2, $nY, $nRadius * 2, $nRadius * 2, -90, 90, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $nX + $nWidth - $nRadius, $nY + $nRadius - 1, $nRadius, $nHeight - $nRadius * 2 + 2, $hBrush)
    _GDIPlus_GraphicsFillPie($hGraphics, $nX + $nWidth - $nRadius * 2, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 0, 90, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $nX + $nRadius - 1, $nY + $nHeight - $nRadius, $nWidth - $nRadius * 2 + 2, $nRadius, $hBrush)
    _GDIPlus_GraphicsFillPie($hGraphics, $nX, $nY + $nHeight - $nRadius * 2, $nRadius * 2, $nRadius * 2, 90, 90, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $nX, $nY + $nRadius - 1, $nRadius, $nHeight - $nRadius * 2 + 2, $hBrush)
    _GDIPlus_GraphicsFillRect($hGraphics, $nX + $nRadius - 1, $nY + $nRadius - 1, $nWidth - $nRadius * 2 + 2, $nHeight - $nRadius * 2 + 2, $hBrush)
    EndFunc

    [/autoit]