im start with Delphi. I have a problem with TStringGrid and Colored the Cell. im using this code for color the BackGround when is selected:
procedure TForm_Matrix.MatrizGeneralDrawCell(Sender: TObject;
ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
ACol:=MatrizGeneral.Col;
ARow:=MatrizGeneral.Row;
begin
if (RBAlto.Checked = True) then // Nivel de color ROJO - ALTO
MatrizGeneral.Canvas.Brush.Color :=clRed;
MatrizGeneral.Canvas.FillRect(Rect);
if (RBMedio.Checked = True) then
MatrizGeneral.Canvas.Brush.Color :=clYellow;
MatrizGeneral.Canvas.FillRect(Rect);
if (RBBajo.Checked = True) then
MatrizGeneral.Canvas.Brush.Color :=clLime;
MatrizGeneral.Canvas.FillRect(Rect);
end;
end;
Its work, but when i try to change the color change the cell selected, and the first cell idk why.
When i select 3 cell with color red. (Work Fine)
Change the color of another cell, change the fist cell T.T
https://i.stack.imgur.com/umG0r.png https://i.stack.imgur.com/1o93C.png
HELP!!!