Hi Leute kann mir bitte jemand erklären wie ich ein abgerundetes Rechteck mit Gdi+ erstellen kann am
besten mit Border. Ich kann das ganze zwar auch per Image lösen doch das gefällt mir nicht so.
bisher habe ich das: sieht ein bisschen albern aus
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
Global $x=100,$y=10,$width = 100,$height = 100 ,$radius = 20
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hPen = _GDIPlus_PenCreate(0xFF4f6793,1,2)
_GDIPlus_GraphicsDrawLine($hGraphic,$x + $radius,$y,$x + $width -$radius,$y,$hPen)
_GDIPlus_GraphicsDrawArc($hGraphic,$x + $width - $radius, $y, $radius,$radius, 270, 90,$hPen)
_GDIPlus_GraphicsDrawLine($hGraphic,$x + $width, $y + $radius, $x + $width,$y + $height - $radius,$hPen)
_GDIPlus_GraphicsDrawArc($hGraphic,$x + $width - $radius, $y + $height - $radius,$radius, $radius, 0, 90,$hPen)
_GDIPlus_GraphicsDrawLine($hGraphic,$x + $width - $radius, $y + $height,$x + $radius, $y + $height,$hPen)
_GDIPlus_GraphicsDrawArc($hGraphic,$x, $y + $height - $radius, $radius,$radius, 90, 90,$hPen)
_GDIPlus_GraphicsDrawLine($hGraphic,$x, $y + $height - $radius, $x, $y + $radius,$hPen)
_GDIPlus_GraphicsDrawArc($hGraphic,$x, $y, $radius, $radius, 180, 90,$hPen)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_Shutdown()
und das ist die lösung per image: geht zwar auch super aber will ich trozdem nicht
Spoiler anzeigen
Func _bitmap_stretch($pic,$nw,$nh)
;by Rodney_le_lude
Local $strech_pointer[3],$gbitmap,$context,$hgraphic
Local $bitmap = _GDIPlus_BitmapCreateFromFile($pic)
If @error Then Return SetError(1)
Local $width = _GDIPlus_ImageGetWidth($bitmap)
Local $height = _GDIPlus_ImageGetHeight($bitmap)
If $nw < $width And $nh < $height Then
$bitmap = _bitmap_reduce($bitmap,$nw,$nh)
Return $bitmap
ElseIf $nw < $width And $nh >= $height Then
$bitmap = _bitmap_reduce($bitmap,$nw,-1)
ElseIf $nw >= $width And $nh < $height Then
$bitmap = _bitmap_reduce($bitmap,-1,$nh)
ElseIf $nw = $width And $nh = $height Then
Return $bitmap
EndIf
$width = _GDIPlus_ImageGetWidth($bitmap)
$height = _GDIPlus_ImageGetHeight($bitmap)
$hgraphic = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
$gbitmap = _GDIPlus_BitmapCreateFromGraphics($nw,$height,$hgraphic)
$context = _GDIPlus_ImageGetGraphicsContext($gbitmap)
$strech_pointer[0] = _GDIPlus_BitmapCloneArea($bitmap,0,0,$width/2,$height,$GDIP_PXF32ARGB)
$strech_pointer[1] = _GDIPlus_BitmapCloneArea($bitmap,$width/2,0,1,$height,$GDIP_PXF32ARGB)
$strech_pointer[2] = _GDIPlus_BitmapCloneArea($bitmap,$width/2,0,$width/2,$height,$GDIP_PXF32ARGB)
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[0],0,0,$width/2,$height)
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[2],$nw-$width/2,0,$width/2,$height)
_GDIPlus_BitmapDispose($strech_pointer[0])
_GDIPlus_BitmapDispose($strech_pointer[2])
For $i = $width/2 To $nw - $width/2 -1
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[1],$i,0,1,$height)
Next
_GDIPlus_BitmapDispose($strech_pointer[1])
$strech_pointer[0] = _GDIPlus_BitmapCloneArea($gbitmap,0,0,$nw,$height/2,$GDIP_PXF32ARGB)
$strech_pointer[1] = _GDIPlus_BitmapCloneArea($gbitmap,0,$height/2,$nw,1,$GDIP_PXF32ARGB)
$strech_pointer[2] = _GDIPlus_BitmapCloneArea($gbitmap,0,$height/2,$nw,$height/2,$GDIP_PXF32ARGB)
_GDIPlus_GraphicsDispose($context)
_GDIPlus_BitmapDispose($gbitmap)
$gbitmap = _GDIPlus_BitmapCreateFromGraphics($nw,$nh,$hgraphic)
$context = _GDIPlus_ImageGetGraphicsContext($gbitmap)
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[0],0,0,$nw,$height/2)
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[2],0,$nh-$height/2,$nw,$height/2)
_GDIPlus_BitmapDispose($strech_pointer[0])
_GDIPlus_BitmapDispose($strech_pointer[2])
For $i = $height/2 To $nh - $height/2 -1
_GDIPlus_GraphicsDrawImageRect($context,$strech_pointer[1],0,$i,$nw,1)
Next
_GDIPlus_BitmapDispose($strech_pointer[1])
_GDIPlus_GraphicsDispose($context)
_GDIPlus_GraphicsDispose($hgraphic)
_GDIPlus_BitmapDispose($bitmap)
Return $gbitmap
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func _bitmap_reduce($bitmap,$width = -1,$height = -1)
;by Rodney_le_lude
If $width = -1 And $height = -1 Then Return $bitmap
Local $hgraphic,$hbitmap,$context
If $width = -1 Then $width = _GDIPlus_ImageGetWidth($bitmap)
If $height = -1 Then $height = _GDIPlus_ImageGetHeight($bitmap)
$hgraphic = _GDIPlus_GraphicsCreateFromHWND(_WinAPI_GetDesktopWindow())
$hbitmap = _GDIPlus_BitmapCreateFromGraphics($width,$height,$hgraphic)
$context = _GDIPlus_ImageGetGraphicsContext($hbitmap)
_GDIPlus_GraphicsDrawImageRect($context,$bitmap,0,0,$width,$height)
_GDIPlus_GraphicsDispose($context)
_GDIPlus_GraphicsDispose($hgraphic)
_GDIPlus_BitmapDispose($bitmap)
Return $hbitmap
EndFunc
[Blockierte Grafik: http://img16.imageshack.us/img16/8209/35323219.th.png]