procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
if (gdfocused in state) or (gdselected in state) or (gdfixed in state) then
   button2.Top:=rect.Top+ StringGrid1.top + 1;
end;
其中if 的作用。