🌹Melanie🌹
🌹Melanie🌹
CC#
Created by 🌹Melanie🌹 on 3/15/2024 in #help
Winforms Controls added at wrong locations
And my code
internal void LoadTabPage(int size)
{
for (int i = 0; i < (size + 1) / 2; i++)
{
for (int j = 0; j < size; j++)
{
tabControl.SelectedTab.Controls.Add(CreateNumberBoxes(false, (size + 1) / 2 - i, j + 1, new Point(102 + 28 * j, 12 + 32 * i)));
}
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < (size + 1) / 2; j++)
{
tabControl.SelectedTab.Controls.Add(CreateNumberBoxes(true, i + 1, (size + 1) / 2 - j, new Point(18 + 28 * j, 104 + 32 * i)));
}
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
tabControl.SelectedTab.Controls.Add(CreateCheckBoxes(i + 1, j + 1, new Point(102 + 28 * i, 108 + 27 * j)));
}
}

TextBox CreateNumberBoxes(bool IsRow, int RCNumber, int InNumber, Point Location)
{
TextBox textBox = new TextBox();

string Letter;
if (IsRow) { Letter = "R"; }
else { Letter = "C"; }

textBox.Name = "textBox" + Letter + "_" + RCNumber + "_" + InNumber;
textBox.Size = new Size(22, 26);
textBox.Location = Location;

return textBox;
}

CheckBox CreateCheckBoxes(int RowNumber, int ColumnNumber, Point Location)
{
CheckBox checkBox = new CheckBox();

checkBox.Name = "checkBox" + RowNumber + "_" + ColumnNumber;
checkBox.AutoSize = true;
checkBox.Location = Location;
checkBox.Size = new System.Drawing.Size(22, 21);
checkBox.UseVisualStyleBackColor = true;

return checkBox;
}
}
internal void LoadTabPage(int size)
{
for (int i = 0; i < (size + 1) / 2; i++)
{
for (int j = 0; j < size; j++)
{
tabControl.SelectedTab.Controls.Add(CreateNumberBoxes(false, (size + 1) / 2 - i, j + 1, new Point(102 + 28 * j, 12 + 32 * i)));
}
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < (size + 1) / 2; j++)
{
tabControl.SelectedTab.Controls.Add(CreateNumberBoxes(true, i + 1, (size + 1) / 2 - j, new Point(18 + 28 * j, 104 + 32 * i)));
}
}
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
tabControl.SelectedTab.Controls.Add(CreateCheckBoxes(i + 1, j + 1, new Point(102 + 28 * i, 108 + 27 * j)));
}
}

TextBox CreateNumberBoxes(bool IsRow, int RCNumber, int InNumber, Point Location)
{
TextBox textBox = new TextBox();

string Letter;
if (IsRow) { Letter = "R"; }
else { Letter = "C"; }

textBox.Name = "textBox" + Letter + "_" + RCNumber + "_" + InNumber;
textBox.Size = new Size(22, 26);
textBox.Location = Location;

return textBox;
}

CheckBox CreateCheckBoxes(int RowNumber, int ColumnNumber, Point Location)
{
CheckBox checkBox = new CheckBox();

checkBox.Name = "checkBox" + RowNumber + "_" + ColumnNumber;
checkBox.AutoSize = true;
checkBox.Location = Location;
checkBox.Size = new System.Drawing.Size(22, 21);
checkBox.UseVisualStyleBackColor = true;

return checkBox;
}
}
4 replies
CC#
Created by 🌹Melanie🌹 on 3/15/2024 in #help
Winforms Controls added at wrong locations
No description
4 replies
CC#
Created by 🌹Melanie🌹 on 3/15/2024 in #help
Winforms Controls added at wrong locations
What it looked like before ^
4 replies