Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Lazarus, FreePascal, Kylix, etc. (https://www.clubdelphi.com/foros/forumdisplay.php?f=14)
-   -   Indicador de posicion TCustomDBGrid (https://www.clubdelphi.com/foros/showthread.php?t=67260)

vichovi 08-04-2010 14:38:59

Indicador de posicion TCustomDBGrid
 
Hola a tod@s,
Tengo un control derivado de TCustomDBGrid en Delphi que estoy migrando a Lazarus. Ya esta prácticamente migrado solo me falta el tema del indicador de posición el cual no logro hacer funcionar, porque o se pinta el indicador por defecto o aparecen todos los registros con el indicador.
El código que utilizo es:
Código:

procedure TviDBGrid.DrawCell(aCol, aRow: Integer; aRect: TRect;
  aState: TGridDrawState);
begin
  inherited DrawCell(aCol, aRow, aRect, aState);

  //Verifico que el DataSet este listo
  if not Listo then
  begin
    exit;
  end;

  //Verifico que el componente este cargado
  if csLoading in ComponentState then
  begin
    exit;
  end;

  //Compruebo que sea la fila y columna a pintar
  if (aCol=0) and (ARow=DataSource.DataSet.RecNo) and (dgIndicator in Options) then
  begin
    Canvas.Brush.Color:=FixedColor;
    inherited Canvas.FillRect(aRect);
    inherited Canvas.Draw(ARect.Left+(ARect.Right-ARect.Left-FSelRow.Width) div 2,
      ARect.Top+(ARect.Bottom-ARect.Top-FSelRow.Height) div 2,FSelRow); //FSelRow es el Bitmap a dibujar
  end;
end;

Lo suyo para esto, tras analizar el fuente del TCustomDBGrid, seria sobreescribir el método DrawFixedText pero no me deja hacerlo :?:

Espero sus comentario.
Un saludo y gracias de antemano.


La franja horaria es GMT +2. Ahora son las 12:22:53.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi