Array of buttons in C++ Windows Forms
I am trying to create an array of button in this game I am making and I cant figure it out so any would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
Button^ button = gcnew System::Windows::Forms::Button();
//button->Parent = this;
// create 2d array of buttons
array<Button^, 2>^ btn = gcnew array<Button^, 2>(2, 2);
// initialize buttons
for (int x = 0; x < 2; ++x)
{
for (int y = 0; y < 2; ++y)
{
btn[x, y] = gcnew System::Windows::Forms::Button();
btn->Parant = this;
btn->Location = System::Drawing::Point(90, 200);
}
}
| |
Last edited on
Topic archived. No new replies allowed.