All pastes #463690 Raw Edit

eventHandlers

public text v1 · immutable
#463690 ·published 2007-04-29 02:06 UTC
rendered paste body
void GUI::initGUI(int *prow, int *pcolumns) {
	int totalTiles = ((int)prow * (int)pcolumns);

	int Xpos = 0;
	int Ypos = 0;

	this->Gboard = gcnew array<System::Windows::Forms::Panel^>(totalTiles);
	for (int i = 0; i < totalTiles; i++) {
		this->Gboard[i] = gcnew System::Windows::Forms::Panel;
//**********************************************************************************************************
		this->Gboard[i]->Click += gcnew System::EventHandler(this, &GUI::customHandlers); 
//**********************************************************************************************************
		this->Gboard[i]->Tag = i;
		this->Gboard[i]->BackColor = System::Drawing::Color::DarkSalmon;
		this->Gboard[i]->Size = System::Drawing::Size(40, 40);
	}

	for (int i = 0; i < totalTiles; i++) {
		if ( i % (int)pcolumns == (int)pcolumns-1) {
			this->Gboard[i]->Location = System::Drawing::Point(Xpos, Ypos);
			Xpos = 0;
			Ypos += 41;
		}
		else {
			this->Gboard[i]->Location = System::Drawing::Point(Xpos, Ypos);
			Xpos += 41;
		}
	}
}

//***************************************************************************
System::Void GUI::customHandlers(System::Object ^sender, System::EventArgs ^e) {
	this->Gboard[1]->Text = "test";
}
//****************************************************************************