Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 19-10-2014
JXJ JXJ is offline
Miembro
 
Registrado: abr 2005
Posts: 2.475
Poder: 21
JXJ Va por buen camino
Question ¿como dibujar texto en un stringgrid?

Saludos

¿como se puede dibujar texto en un stringgrid?

quiero poner texto en una celda. que este a centrado a la mitad de la celda y poner en las esquinas de la celda otros texto.

Gracias.
Responder Con Cita
  #2  
Antiguo 20-10-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola JXJ
Cita:
Empezado por JXJ Ver Mensaje
¿como se puede dibujar texto en un stringgrid?

quiero poner texto en una celda. que este a centrado a la mitad de la celda y poner en las esquinas de la celda otros texto.
Un ejemplo:
Código Delphi [-]
...
implementation

type
  TFiveStr = record
    tleft, tright: string;
    middle       : string;
    bleft, bright: string;
  end;
  TFiveStrArray = array of TFiveStr;

var
  FiveArray: TFiveStrArray;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  with StringGrid1 do
  begin
    ColCount:= 3;
    RowCount:= 6;
    for i:= FixedCols to ColCount-1 do ColWidths[i] := 100;
    for i:= FixedRows to RowCount-1 do RowHeights[i]:= 65;
    if FixedRows = 1 then
      Rows[0].CommaText:= 'Columna1,Columna2,Columna3';
    SetLength(FiveArray, RowCount + FixedRows);
    for i:= Low(FiveArray)+FixedRows to High(FiveArray) do
    begin
      FiveArray[i].tleft := Format('izq_arr %d',[i]);
      FiveArray[i].tright:= Format('der_arr %d',[i]);
      FiveArray[i].middle:= Format('centro: %d',[i]);
      FiveArray[i].bleft := Format('izq_abj %d',[i]);;
      FiveArray[i].bright:= Format('der_abj %d',[i]);;
    end;
  end;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  with Sender as TStringGrid do
    if (ACol = 1)and not(gdFixed in State) then
    begin
      Canvas.FillRect(Rect);
      DrawText(Canvas.Handle, PChar(FiveArray[ARow].tleft) , -1, Rect, DT_SINGLELINE+DT_LEFT+DT_TOP);
      DrawText(Canvas.Handle, PChar(FiveArray[ARow].tright), -1, Rect, DT_SINGLELINE+DT_RIGHT+DT_TOP);
      DrawText(Canvas.Handle, PChar(FiveArray[ARow].middle), -1, Rect, DT_SINGLELINE+DT_CENTER+DT_VCENTER);
      DrawText(Canvas.Handle, PChar(FiveArray[ARow].bleft) , -1, Rect, DT_SINGLELINE+DT_LEFT+DT_BOTTOM);
      DrawText(Canvas.Handle, PChar(FiveArray[ARow].bright), -1, Rect, DT_SINGLELINE+DT_RIGHT+DT_BOTTOM);
    end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  SetLength(FiveArray, 0);
end;

Salida:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 20-10-2014 a las 09:57:32.
Responder Con Cita
  #3  
Antiguo 21-10-2014
JXJ JXJ is offline
Miembro
 
Registrado: abr 2005
Posts: 2.475
Poder: 21
JXJ Va por buen camino
wowww

Gracias

ahora vere si le puedo poner color al fondo del texto..
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Stringgrid doble texto Luvac Varios 12 17-04-2014 06:52:08
Centrar texto StringGrid mizzard C++ Builder 17 11-05-2011 23:20:38
Dibujar contorno de Texto MAXIUM Gráficos 6 10-03-2009 09:45:50
dibujar texto en un TImage zidfrid C++ Builder 3 17-07-2008 15:05:52
Dibujar imagen con ImageList en StringGrid neon OOP 1 20-12-2004 18:24:44


La franja horaria es GMT +2. Ahora son las 01:35:12.


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
Copyright 1996-2007 Club Delphi