Jump to content

Replacing Picture


wiipenmaker
 Share

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...