Desculpe estar me intrometendo. procedure TForm1.sgDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var y , x , AlinharA : integer; begin // AlinharA := 0; // Esquerda // AlinharA := 1; // Centro // AlinharA := 2; // Direita if ACol in [ 0 , 1 ] then AlinharA := 1 else if ACol = 2 then AlinharA := 2 else AlinharA := 0; if gdFixed in State then begin sg.Canvas.Brush.Color := clBtnFace; AlinharA := 1; sg.Canvas.Font.Style := sg.Canvas.Font.Style + [fsBold]; end else begin sg.Canvas.Brush.Color := clWhite; sg.Canvas.Font.Style := sg.Canvas.Font.Style - [fsBold]; end; y := Rect.Top + (Rect.Bottom - Rect.Top - sg.Canvas.TextHeight(sg.Cells[ACol, ARow]) ) div 2; case AlinharA of 1: x := Rect.Left + (Rect.Right - Rect.Left - sg.Canvas.TextWidth(sg.Cells[ACol, ARow]) ) div 2 - 1; // Centro 2: x := Rect.Right - sg.Canvas.TextWidth(sg.Cells[ACol, ARow]) - 2; // Direita else x := Rect.Left + 2; // Esquerda end; sg.Canvas.TextRect(Rect, x , y, sg.Cells[ACol, ARow]); end;
Espero ter ajudado. Alisson Yahoo <[EMAIL PROTECTED]> escreveu: Procure por esse assunto no Google e você deve achar o que procura. Eu já tinha feito isso uma vez, mas depois percebi que era melhor usar DbGrid com ClientDataset e não tenho o código dessa rotina aqui no serviço. Bom dia Alisson!! aproveitando a dica. Tem como alinhar tb alinhar à direita (ou centralizado) o texto de células em especifico??? mto obrigado [As partes desta mensagem que não continham texto foram removidas] __________________________________________________ Fale com seus amigos de graça com o novo Yahoo! Messenger http://br.messenger.yahoo.com/ [As partes desta mensagem que não continham texto foram removidas]