private CellColor GetBackgroundColorForRow(IHTMLTableRow row) { CellColor cellColor = new CellColor(); bool firstCellProcessed = false; foreach (IHTMLTableCell cell in row.cells) { // for the first cell processed, note its color if (!firstCellProcessed) { cellColor.Color = TableHelper.GetColorForHtmlColor(cell.bgColor); firstCellProcessed = true; } // for subsequent cells, if any of them differ from the first cell // then the background color is mixed else { if (cellColor.Color != TableHelper.GetColorForHtmlColor(cell.bgColor)) { cellColor.IsMixed = true; break; } } } return cellColor; }
private void buttonBrowseColor_Click(object sender, System.EventArgs e) { // create the color picker dialog using (ColorDialog colorDialog = new ColorDialog() ) { colorDialog.AllowFullOpen = false; colorDialog.FullOpen = false; colorDialog.Color = CellColor.Color ; // show the color picker dialog using ( new WaitCursor() ) { if ( colorDialog.ShowDialog(FindForm()) == DialogResult.OK ) { // update color CellColor = new CellColor(colorDialog.Color) ; } } } }
public CellBackgroundColorWriter(CellColor backgroundColor) { _backgroundColor = backgroundColor; }