vc++ picturebox array
Hi, I'm currently working on a project that will need to use an array for a image. (Or a way to print one image multiple times in different locations). I have got this much of the code, yet it does not work.
- Note its compiled in vc++ .net 2005
Any help would be appreciated.
array<PictureBox^> ^picB = gcnew array<PictureBox^>(10);
for(Int32 i = 0; i < 10; ++i)
picB[i] = gcnew PictureBox;
picB[i]->Location = Point(i, i);
picB[i]->Size = Drawing::Size(20, 20);
picB[i]->Image = Image::FromFile("square.bmp");
Thanks in advance,
i think this would be more suitable in the windows-specific platform forum (check the main CBoard forums page for the list of them all).
but you said 'it does not work'. ive never used VC++, but i know C++, and VB.net, so im somewhat familiar with the syntax. however, if something doesnt work, you have to tell us what exactly doesnt work (which i guess you have) and why it doesnt work (ie error messages), or what happens instead when your expecting it to do something else.
Well I'm guessing it's probably the way i set it up. (I haven't a clue, since i rarely do vc++ [i mostly stick with basic c++]). There is no error message (compiles fine), and the images don't appear on the screen (Like I'm hoping). So I'm just looking for someone that knows about this subject, or someone that has a different way of setting it up.
i dont have .NET installed so i cant test (or learn VC++!) right now. but the logic looks very straightforward. create an array of pictures and show them.
i just have one point/suggestion, keeping in mind, NB: i dont know VC++.
if your using the same image (ie not a collage of different pictures), and if the image responds (ie to mouse press, etc) the same way no matter what location/image is in question, then i would look for a different method. is there a 'paintimage' or some other function that lets you simply display an image somewhere? because if your using the same image 10 times, its a waste of resources and time you can imagine.
you probably have thought about this and looked for other methods, but if not then check it out. having just the one actual object and reusing that would be better.
EDIT:oh, i see your edit now too! images not appearing would be a problem for sure! again, since i dont know this stuff either im not sure. do you have to set the .visible true or something like that? or a repaint function on the frame? try getting just one to show up first before using a bunch of them, too.