Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i write the code when you click at the sam button to change //

Status
Not open for further replies.

1a2f3a

Programmer
Jan 12, 2008
1
MK
hi !
my problem :

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
pictureBox1->Image=imageList1->Images[0];
pictureBox1->Image=imageList1->Images[1];
pictureBox1->Image=imageList1->Images[2];
pictureBox1->Image=imageList1->Images[3];
pictureBox1->Image=imageList1->Images[4];
pictureBox1->Image=imageList1->Images[5];
}

how can i write the code when you cilck at the sam button to chang the picture in the picturebox

ps: Sorry my english it`s not good :(
 
If the images simly cycle, you might want to try a loop of IF conditionals. For example:

Code:
If showing image 0, then show image 1.
If showing image 1, then show image 2.
...
If showing image n, then show image 1.


I would give a coded example, but I'm not familiar with the Image controls. Sorry.
 
You'll probably need a static variable in your click routine to keep track of what's currently showing.

Code:
static var curimage = 0 ;

curimage = (curimage + 1) mod numimages;
showimage(curimage);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top