Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

[Visual Studio] How to loop through pictureboxes?

loop

  • Please log in to reply
No replies to this topic

#1 chickenwing

chickenwing

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 17 March 2009 - 04:03 AM

Hi all!
I am making a Mastermind Game under Visual C++ with GUI features.

I created many pictureboxes named picturebox1, picturebox2, picturebox 3...

The backcolor of the picturebox will change when the user chooses the color.
But as I have many pictureboxes I need to use loops to access them.

For example...how to make the following clumsy code into a loop?



color_convert (r, g, b, temp[0]);
this->picturebox1->BackColor = System:: Drawing::Color::FromArgb(r, g, B);

color_convert (r, g, b, temp[1]);
this->picturebox2->BackColor = System:: Drawing::Color::FromArgb(r, g, B);

color_convert (r, g, b, temp[2]);
this->picturebox3->BackColor = System:: Drawing::Color::FromArgb(r, g, B);

color_convert (r, g, b, temp[3]);
this->picturebox4->BackColor = System:: Drawing::Color::FromArgb(r, g, B);


thx
  • 0





Also tagged with one or more of these keywords: loop

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download