Как закрасить одну ячейку матрицы или одну строку(столбец) в какой-либо цвет?..
Зарание спасибо...
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if(ACol==1) // или (ARow==1)
StringGrid1->Canvas->Brush->Color = clRed;
// Дальнейшая отрисовка ячейки ...
}
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if(ACol==1) // или (ARow==1)
StringGrid1->Canvas->Brush->Color = clRed;
// Дальнейшая отрисовка ячейки ...
}
type
TFakeStringGrid=class(TStringGrid);
procedure TForm1.Button1Click(Sender: TObject);
begin
TFakeStringGrid(StringGrid1).InvalidateRow(StrToInt(Edit1.Text));
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if ARow=StrToInt(Edit1.Text) then
StringGrid1.Canvas.Brush.Color := clRed;
If (ACol > 0) and (ARow>0) then begin
StringGrid1.canvas.fillRect(Rect);
StringGrid1.canvas.TextOut(Rect.Left,Rect.Top,StringGrid1.Cells[ACol,ARow]);
end;
end;