Hi,
ich habe das Beispiel aus der Hilfe für _WINAPI_RoundRect() verwendet und es aufs nötigste gekürzt (möchte lediglich ein Rechteck mit runden Ecken und in Farbe), verstehe aber nicht wieso ich Zeile 15, 16 benötige, damit er das Rechteck anzeigt. Der Teil mit dem Merge Bitmap ebenfalls. Kann das jemand bitte mal umschreiben, dass ich nur das gerundete Rechteck habe und es dann dem Pic Control zuweisen kann?
#include <APIGdiConstants.au3>
#include <FontConstants.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 400)
Local $idPic = GUICtrlCreatePic('', 0, 0, 60, 60)
Local $hPic = GUICtrlGetHandle($idPic)
; Create bitmap
Local $hDev = _WinAPI_GetDC($hPic)
Local $hDC = _WinAPI_CreateCompatibleDC($hDev)
Local $hSource = _WinAPI_CreateCompatibleBitmapEx($hDev, 400, 400, _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE)))
Local $hSv = _WinAPI_SelectObject($hDC, $hSource)
; Draw objects
Local $hOldBrush = _WinAPI_SelectObject($hDC, _WinAPI_GetStockObject($DC_BRUSH))
Local $hOldPen = _WinAPI_SelectObject($hDC, _WinAPI_GetStockObject($DC_PEN))
_WinAPI_SetDCBrushColor($hDC, 0x990404)
_WinAPI_SetDCPenColor($hDC, 0x990404)
$tRECT = _WinAPI_CreateRect(0, 0, 140, 90)
_WinAPI_OffsetRect($tRECT, 220, 279)
_WinAPI_RoundRect($hDC, $tRECT, 20, 20)
; Merge bitmap
Local $hBitmap = _WinAPI_CreateCompatibleBitmap($hDev, 400, 400)
$hBrush = _WinAPI_SelectObject($hDC, $hOldBrush)
_WinAPI_DeleteObject($hBrush)
Local $hPen = _WinAPI_SelectObject($hDC, $hOldPen)
_WinAPI_DeleteObject($hPen)
_WinAPI_SelectObject($hDC, $hBitmap)
_WinAPI_DrawBitmap($hDC, 0, 0, $hSource, $MERGECOPY)
_WinAPI_ReleaseDC($hPic, $hDev)
_WinAPI_SelectObject($hDC, $hSv)
_WinAPI_DeleteObject($hSource)
_WinAPI_DeleteDC($hDC)
; Set bitmap to control
_SendMessage($hPic, $STM_SETIMAGE, 0, $hBitmap)
$hObj = _SendMessage($hPic, $STM_GETIMAGE)
If $hObj <> $hBitmap Then
_WinAPI_DeleteObject($hBitmap)
EndIf
GUISetState(@SW_SHOW)
[/autoit][autoit][/autoit][autoit]Do
Until GUIGetMsg() = -3