MyEarth Posted February 20, 2015 Share Posted February 20, 2015 Hello Like title and math is my worst enemy. Pratically at the end i'd like a function with the parameters for single square size, like "create a grid of 10x10 pixel every squares" not the number of the total squares A sort of example of a grid using GUICtrlCreateGraphic #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hWidth = 200 $hHeight = 200 $hGui = GUICreate("", $hWidth, $hHeight, -1, -1) GUICtrlCreateGraphic(0, 0, $hWidth, $hHeight) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $hHeight / 3) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00000) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $hWidth, $hHeight / 3) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $hHeight * 2 / 3) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00000) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $hWidth, $hHeight * 2 / 3) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $hWidth / 3, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00000) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $hWidth / 3, $hHeight) GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $hWidth * 2 / 3, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x00000) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $hWidth * 2 / 3, $hHeight) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks for the help Link to comment Share on other sites More sharing options...
Solution UEZ Posted February 20, 2015 Solution Share Posted February 20, 2015 (edited) Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $iWidth = 600 $iHeight = 400 $hGui = GUICreate("", $iWidth, $iHeight, -1, -1) Create_GRID($iWidth, $iHeight) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Create_GRID($iWidth, $iHeight, $iGrid_w = 20, $iGrid_h = 20, $iColorW = 0x00000, $iColorH = 0x00000) Local $x, $y GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight) For $x = 0 To $iWidth / $iGrid_w GUICtrlSetGraphic(-1, $GUI_GR_MOVE, $x * $iGrid_w, 0) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $iColorW) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $x * $iGrid_w, $iHeight) Next For $y = 0 To $iHeight / $iGrid_h GUICtrlSetGraphic(-1, $GUI_GR_MOVE, 0, $y * $iGrid_h) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, $iColorH) GUICtrlSetGraphic(-1, $GUI_GR_LINE, $iWidth, $y * $iGrid_h) Next EndFunc Br,UEZ Edited February 21, 2015 by UEZ jaberwacky 1 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
MyEarth Posted February 21, 2015 Author Share Posted February 21, 2015 Thanks Mr.UEZ BrewManNH 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now