Hello
I have a "canvas" (which is just a Panel Control), and the user can click a button to add certain controls to the canvas i.e. labels, link labels, images etc... And then they can edit those controls, like they can edit the text of the label they just added...
But I'm trying to let them choose a new font and a new color for the control that they clicked on, but it doesn't always work, even though it should be...
the code i have is:
private string SelectedControl;
when i click on a control:
private void label_Click(object sender, EventArgs e)
{
Label label = (Label)sender;
SelectedControl = label.Name;
}
when the user selects a font:
private void setfont()
{
foreach(Control control in Canvas.Controls)
{
if(control.Name == SelectedControl)
{
control.Font = selectedfont;
}
}
}
So, This code does work BUT just not all the time. Does anybody know of any other way to somehow keep track of the Last-Clicked control, so it can be referenced later?