Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. if (nButtons % 4 <= 1) //
  2.             {
  3.                 turns = (nButtons / 4);
  4.                 turns = turns - 1;
  5.             }
  6.             else
  7.             {
  8.                 turns = nButtons / 4;
  9.             }
  10.             if (turns > 0) // If turns is greater than ZERO
  11.             {
  12.                 // Start positioning buttons by groups of 4 until last set quantity is 5 or lower
  13.                 int x = 0;
  14.                 for (int j = 0; j < turns; j++)
  15.                 {
  16.                     btnmgr.PlaceButtons(x, 4, 3, 5); // 'x' starts as 0, so first pos in nButtons will be ZERO
  17.                     x += 4; // Each time PlaceButtons is called, add 4 to 'x' so next iteration will place all buttons after last 4.
  18.                 }
  19.                 if (nButtons - turns * 4 > 0) // nButtons - turns*4 means
  20.                 {
  21.                     btnmgr.PlaceButtons((turns * 4), (nButtons - (turns * 4)), 0, 5);
  22.                 }
  23.             }
  24.             else
  25.             {
  26.                 if (nButtons == 1)
  27.                 {
  28.                     btnmgr.Place1Button();
  29.                 }
  30.                 else
  31.                 {
  32.                     btnmgr.PlaceButtons(0, nButtons, 0, nButtons);
  33.                 }
  34.             }
  35.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement