/// <summary> /// 依据着色命令对表格行进行着色 /// </summary> /// <param name="command">着色命令</param> public void CustomDrawCellByCommand(CustomDrawCellCommand command) { if (command == null) { return; } //如果没有设置高亮filter if (this.drawCellCommand == null) { this.drawCellCommand = command; gridView.CustomDrawCell += gridView_CustomDrawCell; for (int index = 0; index < this.gridView.RowCount; index++) { this.gridView.RefreshRow(index); } } else { //判断是否和当前filter一致 if (this.highLightRowCommand.Tag.Equals(command.Tag) == false) { gridView.CustomDrawCell -= gridView_CustomDrawCell; gridView.CustomDrawCell += gridView_CustomDrawCell; for (int index = 0; index < this.gridView.RowCount; index++) { this.gridView.RefreshRow(index); } } } }
/// <summary> /// 移除着色命令 /// </summary> public void RemoveCustomDrawCellCommand() { try { this.drawCellCommand = null; gridView.CustomDrawCell -= gridView_CustomDrawCell; } catch (Exception) { } finally { for (int index = 0; index < this.gridView.RowCount; index++) { this.gridView.RefreshRow(index); } } }