Jump to content

Possible to Draw the shape attached with GDI or other functions?


Recommended Posts

#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()
Exit

Func _Main()
    Local $hGUI
    Local $hRgn, $hDC, $hBrush

    ; Create GUI
    $hGUI = GUICreate("Test", 200, 500)
    GUISetState()
    GUISetBkColor(0xE6F2F7)

    ; Draw arcs
    _GDIPlus_Startup ()
    $hDC = _WinAPI_GetDC($hGUI)
    $hRgn = _CreateEllipticRgn(100, -100, 300, 500)
    $hBrush = _WinAPI_CreateSolidBrush(0xFFFFFF)
    ;_WinAPI_SelectObject($hDC, $hBrush)
    ;_WinAPI_SelectObject($hDC, $hRgn)
    _FillRgn($hDC, $hRgn, $hBrush)
    
    Do
    Until GUIGetMsg() = -3
    
    _WinAPI_DeleteObject($hBrush)
    _WinAPI_DeleteObject($hRgn)
    _WinAPI_ReleaseDC($hGUI, $hDC)
EndFunc


Func _CreateEllipticRgn($iLeftRect, $iTopRect, $iRightRect, $iBottomRect)
    Local $aRet
    
    $aRet = DllCall('gdi32.dll', 'int', 'CreateEllipticRgn', 'int', $iLeftRect, 'int', $iTopRect, _
                'int', $iRightRect, 'int', $iBottomRect)
                
    If @error Or $aRet[0] = 0 Then Return SetError(1, 0, 0)
    Return $aRet[0]
EndFunc

Func _FillRgn($hDC, $hRgn, $hBrush)
    Local $aRet
    
    $aRet = DllCall('gdi32.dll', 'int', 'FillRgn', 'int', $hDC, 'int', $hRgn, 'int', $hBrush)
    
    If @error Or $aRet[0] = False Then Return SetError(1, 0, False)
    Return SetError(0, 0, True)
EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...