Sign in to follow this  
Followers 0
DjDeep00

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

5 posts in this topic

#1 ·  Posted (edited)

Was wondering if I could draw this shape instead of using the pic control?

post-3353-1243023436_thumb.jpg

Edited by DjDeep00

Share this post


Link to post
Share on other sites



I'm no expert but have you tried _GDIPlus_GraphicsDrawClosedCurve and the relative fill function?

MDiesel

Share this post


Link to post
Share on other sites

@mdiesel...Yeah dude I got nothing after trying all sorts of GDI functions..I will keep trying never really worked with these before....

How would I fill in a custom color for the graphic?

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

Thanks Authenticity... :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0