hraŠibenice
1. Založte novou aplikaci Windows Forms Application a pojmenujte ji sibenice
Do aplikace přidejte odkazy na hlavičkové soubory:
#pragma once
#include <time.h>
#include <stdlib.h> /* obsahuje funkce rand a srand */
#include <string>
2. Nadeklarujte potřebné proměnné
private:
System::ComponentModel::Container ^components;
System::Windows::Forms::Button^* radek;
System::Windows::Forms::Button^* psluvko;
String^ hadane; //ukazatel na řetězec znaků - hádané slovo
void pismena()
{
String^ abeceda = gcnew String("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
radek = (System::Windows::Forms::Button^*)malloc(26*sizeof(System::Windows::Forms::Button^));
for (int i = 0; i<26; i++)
{
radek[i]=(gcnew System::Windows::Forms::Button());
radek[i]->Parent = this;
radek[i]->Size = System::Drawing::Size(50,50);
radek[i]->Left = 50 + 60*(i % 10);
radek[i]->Top = 150 + 60 * (i / 10);
radek[i]->Text = abeceda->Substring(i,1);
//radek[i]->FlatStyle =
System::Windows::Forms::FlatStyle::Flat;
radek[i]->BackColor = System::Drawing::Color::Gold;
radek[i]->Click += gcnew System::EventHandler(this, &sibenice::Form1::tlacitko_Click);
//Controls->Add(radek[i]);
}
}