i have placed two text boxes and one context menu strip for font,color(color is having two sub menu's i.e Fore color,back color)..
i assigned contextmenu property for both the text boxes.What i want is when i right click on the textbox1 r textbox2 for changing the fore color of the text, the respective textbox fore color should be change..
i had written like this but whether this is write or not i dn't know
private void foreColorToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Control x in this.Controls)
{
if (x is TextBox)// here am checking for textboxes
{
TextBox t = (TextBox)x;
if (t.Focused==false)
{
colorDialog1.ShowDialog();
textBox1.ForeColor = colorDialog1.Color;
return;
}
else
{
colorDialog1.ShowDialog();
textBox2.ForeColor = colorDialog1.Color;
return;
}
}
}
}
Sravanthi.seeta, if this helps please login to Mark As Answer. | Alert Moderator