Jump to content
Sign in to follow this  

GUICtrlCreateGraphic parameters meaning?

Recommended Posts


GUICtrlCreateGraphic accepts position and size parameters (top,left,width,height). what do they mean? even if i set all to zero i can still draw graphics all over my GUI:

#include <GUIConstantsEx.au3>


Func Example()
    Local $hGUI = GUICreate("Example")
    ; setting the graphic area to basically nothing:
    Local $gGraphic = GUICtrlCreateGraphic(0, 0, 0, 0)
    GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 10, 10)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, 40, 40)
    ; the above line is drawn even though it's out of te graphi area!
    GUISetState(@SW_SHOW, $hGUI)
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example


Share this post

Link to post
Share on other sites

Width and height parameters are used by GUICtrlSetBkColor and similar commands. Mouse clicks are detected only in the area delimited by width and height. See the example for GUICtrlCreateGraphic in Help file.

Left and top parameters is the starting point for x- and y-coordinates of GUICtrlSetGraphic as stated in the Help file: "The point position (x,y) is relative to the GUICtrlCreateGraphic() coordinates. It can be outside the graphic control but inside of the GUI window."

"relative to the GUICtrlCreateGraphic() coordinates" means relative to left and top parameters.

If left and top is in the middle of the GUI, x- and y-coordinates can be negative.

If you only want to draw graphics with GUICtrlSetGraphic and don't need commands like GUICtrlSetBkColor and don't need to detect mouse clicks, you can set width and height to zero.

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