priya

priya

  • NA
  • 32
  • 11.7k

alternate color row...

Jun 13 2015 3:28 AM
this is the logic of color row... in which cursor is present...
 
public void changecolorrow()
{
mshtmlTable table = null;
mshtmlTableRow row = null;
mshtmlTableCell cell = null;
GetTableElement(out table, out row, out cell);
HtmlElement table1 = getTableHTMLElement();
int index = row.rowIndex;
HtmlElement row1 = table1.GetElementsByTagName("tr")[index];
if (table != null)
{
try
{
using (ColorDialog colorDialog = new ColorDialog())
{
colorDialog.AnyColor = true;
colorDialog.SolidColorOnly = true;
colorDialog.AllowFullOpen = true;
colorDialog.Color = ColorTranslator.FromHtml(row1.GetAttribute("Background-color"));
colorDialog.CustomColors = _customColors;
if (colorDialog.ShowDialog(this.ParentForm) == DialogResult.OK)
{
_customColors = colorDialog.CustomColors;
row.bgColor = ColorTranslator.ToHtml(colorDialog.Color);
}
}
}
catch (Exception ex)
{
throw new HtmlEditorException("Unable to colour the row", "Colour row", ex);
}
}
else
{
throw new HtmlEditorException("Table not currently selected ", "Colour row");
}
}
 
 
 
through this logic i just want to color alternate row..... from the row where cursor is present...... 

Answers (1)