¿como estas implementando el top row?
¿estas tomando un Dbgrid como Stringgrid?. porque Toprow es un propiedad de los CustomGrid (StringGrid y DrawGrid). Dbgrid es una grilla virtual que muestra el contenido de un DataSet.
¿es sobre una tabla filtrada?
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
Var
R : Integer;
begin
R :=TStringGrid(DbGrid1).Row;
TStringGrid(DbGrid1).TopRow := R;
end;
De esa forma guardas y re-estableces toprow.
Por otro lado. Prueba también agregar al formulario principal de tu proyecto (si es MDI) o bien al form donde tienes la grilla un TApplicationEvens con este código.
Código Delphi
[-]
procedure TFPrincipal.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
var
i: SmallInt;
begin
if Msg.message = WM_MOUSEWHEEL then
begin
Msg.message := WM_KEYDOWN;
Msg.lParam := 0;
i := HiWord(Msg.wParam) ;
if i > 0 then
Msg.wParam := VK_UP
else
Msg.wParam := VK_DOWN;
Handled := False;
end;
end;
Con lo anterior he solucionado detalles de repintado de grids y sobretodo problemas de repintado de grids cuando se usa el scroll del mouse.