StringGrid - Centralizar Conteúdo na Vertical
22/09/2004
0
Como centralizar o conteúdo de uma célula de um StringGrid na vertical?
Jose Almeida
Curtir tópico
+ 0
Responder
Posts
22/09/2004
Marcelo Saviski
Dê uma olhada aqui, http://delphiforum.icft.com.br/forum/viewtopic.php?t=50966&highlight=stringgrid
só no último parâmetro da função troque por [b:9c1bee9d2c]DT_VCENTER[/b:9c1bee9d2c]
só no último parâmetro da função troque por [b:9c1bee9d2c]DT_VCENTER[/b:9c1bee9d2c]
Responder
25/09/2004
Jose Almeida
A questão e a seguinte.
Tenho este código que determina o topo e o afastamento
[color=green:07af9d73cc]procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
StringGrid1.Canvas.TextOut
(Rect.Left+10,Rect.Top+6,StringGrid1.Cells[ACol,ARow]);
end;[/color:07af9d73cc]
´Rect.Left+10´ determina o afastamento à esquerda.
´Rect.Top+6´ determina o topo.
Tenho este outro que centraliza o texto na célula mas não permite
determinar o topo.
[color=green:07af9d73cc]procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
DrawText(StringGrid1.Canvas.Handle,PChar
(StringGrid1.Cells[ACol,ARow]),-1,Rect,DT_Center);
end;[/color:07af9d73cc]
Quero centralizar o texto na horizontal e determinar o topo ou centralizar na vertical simultaneamente.
Tenho este código que determina o topo e o afastamento
[color=green:07af9d73cc]procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
StringGrid1.Canvas.TextOut
(Rect.Left+10,Rect.Top+6,StringGrid1.Cells[ACol,ARow]);
end;[/color:07af9d73cc]
´Rect.Left+10´ determina o afastamento à esquerda.
´Rect.Top+6´ determina o topo.
Tenho este outro que centraliza o texto na célula mas não permite
determinar o topo.
[color=green:07af9d73cc]procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
DrawText(StringGrid1.Canvas.Handle,PChar
(StringGrid1.Cells[ACol,ARow]),-1,Rect,DT_Center);
end;[/color:07af9d73cc]
Quero centralizar o texto na horizontal e determinar o topo ou centralizar na vertical simultaneamente.
Responder
Clique aqui para fazer login e interagir na Comunidade :)