Sure, cast it to ShapeControl because Control class doesn't contain Growing property.
private void Grow(object sender, EventArgs e)
{
Shape controlAll = (Shape)sender;
controlAll.Growing = 50;
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Very easy, I'll write code, when user presses on the button, it creates object fron ListBox type and create an event for it also...
private void Grow(object sender, EventArgs e)
{
ListBox lstBoxForItems = new ListBox();
lstBoxForItems.Items.Add("1");
lstBoxForItems.Items.Add("2");
lstBoxForItems.Items.Add("3");
lstBoxForItems.Show();
this.Controls.Add(lstBoxForItems);
lstBoxForItems.SelectedIndexChanged += new EventHandler(lstBoxForItems_SelectedIndexChanged);
}
void lstBoxForItems_SelectedIndexChanged(object sender, EventArgs e)
{
MessageBox.Show(lstBoxForItems.SelectedItem.ToString());
}
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276