How I can a marked table-cell the cell-color alter
How I can a marked table-cell the cell-color alter
How I can a marked table-cell the cell-color alter
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Do you want to know how to change background color for selected cells?
This code makes the selected cells red (as an editing operation):
Or do you want to use another color to highlight selection?
In this case, see properties of TRVStyle: SelColor, SelTextColor, InactiveSelColor, InactiveSelTextColor.
This code makes the selected cells red (as an editing operation):
Code: Select all
procedure TForm1.Color1Click(Sender: TObject);
var rve: TCustomRichViewEdit;
table: TRVTableItemInfo;
r,c,i: Integer;
begin
if not RichViewEdit1.CanChange or
not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve,
TCustomRVItemInfo(table)) then
exit;
rve.BeginUndoGroup(rvutModifyItem);
rve.SetUndoGroupMode(True);
try
for r := 0 to table.RowCount-1 do
for c := 0 to table.ColCount-1 do
if (table.Cells[r,c]<>nil) and (table.IsCellSelected(r,c)) then
table.SetCellColor(clRed, r,c);
finally
rve.SetUndoGroupMode(False);
end;
rve.Change;
end;
In this case, see properties of TRVStyle: SelColor, SelTextColor, InactiveSelColor, InactiveSelTextColor.