using context Menu strip i would like to apply color to particular column

I used two Events those are
1.private void applyColorToolStripMenuItem_Click(object sender, EventArgs e)
{
applyColorToolStripMenuItem.BackColor = Color.Aqua;
color = Convert.ToString(applyColorToolStripMenuItem.BackColor);


}
private void Model_QueryCellInfo(object obj, GridQueryCellInfoEventArgs e)
{
int r1= gridDataBoundGrid1.CurrentCell.RowIndex;
int c1 = gridDataBoundGrid1.CurrentCell.ColIndex;

if (e.RowIndex < 0 && e.ColIndex < 0)
{
e.Style.BackColor = gridDataBoundGrid1.BackColor;
}
else
{
if (r1.Equals(e.RowIndex)
&& c1.Equals(e.ColIndex))
{
GridStyleInfo info = new GridStyleInfo();
info.BackColor = applyColorToolStripMenuItem.BackColor;
e.Style.BackColor = info.BackColor;
}
}
}
the problem is when i click particular cell the backgroundcolor is changed to backgroundcolor of context menu strip item color it is not correct.
i need this functionality when i right click context menu strip will be appeared and when I click on ApplyColor Task,Task color should be applied



1 Reply

SR Sri Rajan Syncfusion Team June 30, 2008 10:26 AM UTC

Hi Mahesh,

Thank you for your interest in Syncfusion products.

Please try this coding to change the backcolor of a particular column, using Context Menu Strip.

private void applyColorToolStripMenuItem_Click(object sender, EventArgs e)
{
applyColorToolStripMenuItem.BackColor = Color.Aqua;
this.gridDataBoundGrid1.Binder.InternalColumns[3].StyleInfo.BackColor = Color.Aqua;
this.gridDataBoundGrid1.Refresh();
}



Please let me know if this helps.

Best Regards,
Srirajan.


Loader.
Up arrow icon