Jump to content
Sign in to follow this  
wiipenmaker

Replacing Picture

Recommended Posts

wiipenmaker

I have 3 seperate image files.

I would like to be able to the following in one GUI

one of the pics named 1 2 or 3 .jpg is displayed a random number of times

When a button is pressed a different image 1 2 or 3 .jpg is displayed a random number of times

This is how I have the original pictures being displayed

$x = Random(1,9,1)

$p = Random(1,3,1)

For $i = 1 to $x

GUICtrlCreatePic($p&".jpg",100*($i-1),0,100,100)

Next

Thanks

Edited by wiipenmaker

Share this post


Link to post
Share on other sites
wiipenmaker

My problem is that if I name the GUICtrlCreatePic, $pic then the set image would only work for one not all random x of them

I have 3 seperate image files.

I would like to be able to the following in one GUI

one of the pics named 1 2 or 3 .jpg is displayed a random number of times

When a button is pressed a different image 1 2 or 3 .jpg is displayed a random number of times

This is how I have the original pictures being displayed

$x = Random(1,9,1)

$p = Random(1,3,1)

For $i = 1 to $x

GUICtrlCreatePic($p&".jpg",100*($i-1),0,100,100)

Next

Thanks

Share this post


Link to post
Share on other sites
Zedna

Maybe something like this?

$pic1 = GUICtrlCreatePic("",0,0,100,100) 
$pic2 = GUICtrlCreatePic("",100,0,100,100) 
$pic3 = GUICtrlCreatePic("",200,0,100,100) 

For $i = 1 to 3
  $p = Random(1,3,1) 
  GUICtrlSetImage(Eval("pic" & $i), $p & ".jpg") 
Next

EDIT: corrected syntax errors in Eval

Edited by Zedna

Share this post


Link to post
Share on other sites
wiipenmaker

It worked thanks

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  

×