Skyrimfus

GUI not showing correctly

2 posts in this topic

Hello,

I have this piece of code

$x = 20

for $i=1 to 6 step 1


$GUIDraw  = GUICtrlCreateGraphic(70, 40, 530, 145)

GUICtrlSetGraphic($GUIDraw,$GUI_GR_RECT,$x,20,20,20)

$x= $x+20



next

This program should draw 6 Rectangles but it only draws 5 of them and the 6th is not drawn. Replacing 6 steps to 7 would draw 6 rectangles but if i were to draw 1 more at a custom position it would draw the 7th witch is $x+7*20

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Here you go man. 

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Global Const $g_MAXGr = 6
Global $g_aidGraphics[$g_MAXGr + 1]


Example()

Func Example()
    Local $i
    Local $x = 20

    GUICreate("My Main", -1, -1, 1, 1)

    For $i = 1 To 6 Step 1
        $g_aidGraphics[1] = GUICtrlCreateGraphic($x, $x, 100, 100)
        GUICtrlSetBkColor(-1, 0xffffff)
        GUICtrlSetColor(-1, 0)

        $x = $x + 20
    Next
    GUISetState(@SW_SHOW)

EndFunc   ;==>Example

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

 

Edited by aa2zz6

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