MyEarth

Circular GUI?

5 posts in this topic

#1 ·  Posted (edited)

Reading the help, sometimes i'll do it for learn new things, i have see this function and the relative example:

_WinAPI_CreateRoundRectRgn

And i have think, if i want to make a circular GUI starting from a perfect square GUI like? What kind of math calculation need to do?

Thanks for the help

 

Edited by MyEarth

Share this post


Link to post
Share on other sites



There is no math needed:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Global Const $iW = 800, $iH = 800
Global Const $hGUI = GUICreate("Round GUI", $iW, $iH, -1, -1, $WS_POPUP)
GUISetBkColor(0x0)
Global Const $hRegion = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, $iW, $iH)
_WinAPI_SetWindowRgn($hGUI, $hRegion)
Global Const $iBtn_X = GUICtrlCreateButton("Exit", ($iW - 50) / 2, ($iH - 50) / 2, 50, 50)
GUISetState()

Do
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $iBtn_X
            _WinAPI_DeleteObject($hRegion)
            GUIDelete()
            Exit
    EndSwitch
Until False

 

1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

UEZ thanks. Can i clean the resource in this way? There are drawback?

_WinAPI_SetWindowRgn($hGUI, $hRegion)
_WinAPI_DeleteObject($hRegion) ;<<<<

Or i need to delete only when i close the GUI?

Edited by MyEarth

Share this post


Link to post
Share on other sites

I would release the object on close to be on the safe side.


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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