Ver Mensaje Individual
  #5  
Antiguo 22-09-2004
Avatar de yusnerqui
yusnerqui yusnerqui is offline
Miembro
 
Registrado: mar 2004
Ubicación: Cuba
Posts: 679
Reputación: 21
yusnerqui Va por buen camino
Esto Funciona

Como bien dice el amigo roman, se trata del mismo evento así que con solo unas pequeñas modificaciones lo podrás adaptar a lo que quieres.
Código Delphi [-]
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var sCad:String;
    i: integer;
begin 
  if ACol=2 then // voy a alinear a la derecha la 3ª columna
  if ARow>0 then //No quiero alinear la línea de títulos
    if StringGrid1.Cells[ACol,ARow] <> '' then 
    begin 
       sCad := StringGrid1.Cells[ACol,ARow];
         with StringGrid1 do 
            with Canvas,Rect do 
            begin 
               i:=Right-TextWidth(sCad+' ');
               Canvas.FillRect(Rect);
               Canvas.TextOut(i,Top+2,sCad);
            end;      
    end; 
end;


Esto lo probé y me funciona.

Espero te Ayude.

Un saludo
__________________
Lo importante no es llegar primero, sino saber llegar.

Para que puedas llegar mejor lee la Guia de Estilo

Responder Con Cita