Use a procedure abaixo

procedure AlinhaGrid(Grid : TStringGrid; ACol, ARow : Longint; Rect : TRect;  
State : TGridDrawState; Align : array of Integer);
var S : array[0..255] of Char;
begin
   //0-Esquerda    1-Centro      2-Direita}
   if (ARow = 0) or (ACol > Length(Align)-1) and (Align[ACol] = 0) then
      Exit
   else if (Align[ACol] = DT_LEFT) then
       ExtTextOut(Grid.Canvas.Handle, Rect.Left + ACol, Rect.Top+2, ETO_OPAQUE 
or
       ETO_CLIPPED, @Rect, StrPCopy(S, Grid.Cells[ACol,ARow]), 
Length(Grid.Cells[ACol,ARow]), nil)
   else if (Align[ACol] = DT_RIGHT) then
       ExtTextOut(Grid.Canvas.Handle, Rect.Right - 
Grid.Canvas.TextWidth(Grid.Cells[ACol,ARow]) - 3, Rect.Top+2,
       ETO_OPAQUE or ETO_CLIPPED, @Rect, StrPCopy(S, Grid.Cells[ACol,ARow]),
       Length(Grid.Cells[ACol,ARow]), nil)
   else if (Align[ACol] = DT_CENTER) then
       ExtTextOut(Grid.Canvas.Handle, Rect.Left + (Rect.Right - Rect.Left - 
Grid.Canvas.TextWidth(Grid.Cells[ACol,ARow]))
       div 2, Rect.Top+2, ETO_OPAQUE or ETO_CLIPPED, @Rect,
       StrPCopy(S, Grid.Cells[ACol,ARow]), Length(Grid.Cells[ACol,ARow]), Nil);
end;


Faça a chamada no evento OnDrawCell : 
AlinhaGrid(NomeStringGrid, ACol, ARow, Rect, State, [0,0,2, 1, 2,....])

[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

Para ver as mensagens antigas, acesse:
 http://br.groups.yahoo.com/group/delphi-br/messages

Para falar com o moderador, envie um e-mail para:
 [EMAIL PROTECTED] ou [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a