c# - how to position an object using variables -


I am trying to create 81 picture boxes and have positioned them automatically at a certain distance apart from each other. But they seem to keep in any logical order that I have to start the X point for the -1700 so that the screen also appears. The following code gets the first 15 where I want them, but then they start stacking on each other rather than continuing the pattern. This is the result of an hour of tinkering but in the beginning the argument looks fine. I also had a message box that was being displayed at current X, Y and it was right that it would not be kept on those coordinates.

  int x = -1700; Int Y = 0; For (Int i = 0; I <81; i ++) {This. Control. Update (Champion Thumbnail Nailre [I]); Champion thumbnail Nilrere [Ii] .ight = 80; Champion thumbnail nilayer [i]. With = 80; Champion thumbnail NeilArere [i]. Place = new point (x, y); // message box. Show (convert toaster (x) + "," + convert. Toaster (y)); Champion thumbnail NeilArere [i]. Image Location = Akli Grab image (); //championThumbNailsArray.de].ImageLocation = ChampionAurre [i] .grabPicture (); If (x and lt; = 425) x = x + 85; Other {X = -1700; Y = Y + 85; }}    

This code works as you expect

  private zeros form 1_load (object sender, event_arriage_e) {int x = 0; Int y = 0; For (Int i = 0; I <81; i ++) {Painters P = New Picture Box (); P.BorderStyle = Border Style. Fix 3D; P. Heights = 80; P. With = 80; P. Place = new point (x, y); X + = 85; If (x> 425) {x = 0; Y = = 85; } this. Control. Add (p); }}   

Enter image details here

But I will go with something like Eddie said, a flow layout control

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -