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