0
A
回答
0
您可以使用網格的CellProperties
屬性color單個細胞。您可以使用此上色整行:
var
RowIndex: Integer;
ColIndex: Integer;
with MyDBAdvGrid do
begin
// you choose the row index; you may want to iterate all rows to
// color each of them
RowIndex := 2;
// now iterate all (non-fixed, visible) cells in the row and color each cell
for ColIndex := FixedCols to ColCount - 1 do
begin
CellProperties[ColIndex, RowIndex].BrushColor := clYellow;
CellProperties[ColIndex, RowIndex].FontColor := clGreen;
end;
end;
要使用記錄數據,我建議當用戶移動鼠標更新它填補你的辦公室提示。使用MouseToCell
函數獲取鼠標下的行和列,然後使用MyDBAdvGrid.AllCells[ColIndex, RowIndex]
來訪問單元格內容。
0
Heinrich答案的替代方法是使用OnGetCellColor
事件。同樣
procedure TDBAdvGrid.DBGridGetCellColor(Sender: TObject; ARow,
ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
begin
if (your condition) then ABrush.Color := clRed;
end;
的提示:
這可以使用像這樣
procedure TDBAdvGrid.DBGridGridHint(Sender: TObject; ARow, ACol: Integer;
var hintstr: String);
begin
hintstr := 'your hint text';
end;
相關問題
- 1. Excel:如何根據具有相同值的其他單元格的顏色對單元格進行着色?
- 2. 如何根據Epplus中的單元格值爲行着色?
- 3. jqGrid根據單元格值在網格中着色整條線
- 4. 如何根據單元格中的值在Excel中爲單元格着色?
- 5. 根據單元格中的值着色單元格
- 6. 如何根據不同單元格的顏色突出顯示單元格顏色
- 7. 如何使用不同顏色爲RichTextBox中的不同單詞着色?
- 8. 如何根據單元格的值對jtable的單元格進行着色
- 9. 如何根據單元格值對所有行進行着色
- 10. 使用jQuery根據單元格值更改行的顏色
- 11. 如何爲不同的單元格設置不同的顏色
- 12. 根據另一個單元格的值爲單元格區域着色?
- 13. 如何根據值更改更改單元格的顏色
- 14. 如何根據ooo-calc上的單元格值設置單元格顏色?
- 15. 如何在網格單元中着色不同的值
- 16. 如何根據單元格值更改gridview單元格的顏色?
- 17. 根據單元格值爲HTML/jquery表格單元格設置顏色
- 18. 根據值更改表格單元格的顏色
- 19. 如何使用FormatConditions根據單元格值與其他單元格的比較來更改單元格顏色?
- 20. 如何根據單元格值更改DataGrid單元格背景顏色
- 21. 使用範圍顏色從命名範圍着色單元格
- 22. VBA根據單元格數量更改單元格的顏色
- 23. 如何爲不同顏色的點着色,如果數據屬性不爲空
- 24. 基於一組不同顏色的單元格更改單元格顏色
- 25. 如何根據漸變採用不同顏色的geom_smooth線?
- 26. 如何爲tableview單元格設置不同的顏色
- 27. Excel VBA根據值更改單元格的顏色
- 28. 使用單元格值在Google文檔中着色單元格
- 29. 根據另一個調用的顏色更改單元格的顏色。 Excel中
- 30. jquery datatable.net根據單元格的值更改行顏色
感謝它,但是當u告訴CellPropierties,意味着對哪些事件? – Gwenael
某些事件指示數據更改。這取決於你如何使用你的網格。有這麼多的事件在這件事上... –