with Sender as TStringGrid do
begin
if gdFocused in State then
begin
Canvas.Brush.Color := $1FFFFF1F;
Canvas.FillRect(Rect);
Canvas.TextOut(Rect.Left,Rect.Top,MSGgin.Sg.Cells[ACol,ARow]);
Canvas.DrawFocusRect(Rect);
end;
end;
ondrawcell中加入:
var
strgrid:Tstringgrid;
begin
strgrid:=sender as tstringgrid;
if (row=strgrid.row) and (strgrid.Focused) then
strgrid.Canvas.Brush.Color := clRed
else
strgrid.Canvas.Brush.Color := clWindow;
strgrid.Canvas.FillRect(Rect);
end;