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 11-11-2015
wil_ramone wil_ramone is offline
Registrado
NULL
 
Registrado: nov 2015
Posts: 7
Poder: 0
wil_ramone Va por buen camino
Exclamation encabezado en un grid

Buenos días

como puedo poner el encabezado en forma horizontal en un grid?

es decir que no aparezca a si: ZONA

necesito que aparezca a si:
Z
O
N
A

espero me puedan ayudar gracias......
Responder Con Cita
  #2  
Antiguo 11-11-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Primero vas a tener que aprender qué es horizontal y vertical
Responder Con Cita
  #3  
Antiguo 11-11-2015
wil_ramone wil_ramone is offline
Registrado
NULL
 
Registrado: nov 2015
Posts: 7
Poder: 0
wil_ramone Va por buen camino
grid

en forma vertical me confundí una disculpa
Responder Con Cita
  #4  
Antiguo 11-11-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Prueba con: 'H'#13'O'#13'L'#13'A'
Responder Con Cita
  #5  
Antiguo 11-11-2015
wil_ramone wil_ramone is offline
Registrado
NULL
 
Registrado: nov 2015
Posts: 7
Poder: 0
wil_ramone Va por buen camino
esa fue mi primera opción y no funciono solo me agrego z|ona
Responder Con Cita
  #6  
Antiguo 11-11-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
¿Qué componente grid es?
Responder Con Cita
  #7  
Antiguo 11-11-2015
wil_ramone wil_ramone is offline
Registrado
NULL
 
Registrado: nov 2015
Posts: 7
Poder: 0
wil_ramone Va por buen camino
es un stringGrid

este es el código que uso para los títulos

_verRporte.stgReportes.Cells[0,0]:='ZONA';
_verRporte.stgReportes.Cells[1,0]:='SUP. ZONA';
_verRporte.stgReportes.Cells[2,0]:='No.';
_verRporte.stgReportes.Cells[3,0]:='SITIO';
_verRporte.stgReportes.Cells[4,0]:='SUCURSAL';
_verRporte.stgReportes.Cells[5,0]:='FECHA DE REGISTRO';

es el que necesito que cambie de orientación

y este es el que utilizo para darle color desde el evento OnDrawCell

if (ARow=0) and (ACol<=5) then begin
Canvas.Brush.Color := clBlack;
canvas.Font.Style:=[FsBold];
canvas.Font.Color:=clWhite;
Canvas.TextRect(Rect, Rect.Left + 3, Rect.Top + 2, cells[Acol, Arow]);
Canvas.FrameRect(Rect);
end;
Responder Con Cita
  #8  
Antiguo 11-11-2015
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.038
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Mira esto.

Por cierto, recuerda poner los tags al código fuente, ejemplo:



Gracias
Responder Con Cita
  #9  
Antiguo 11-11-2015
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 will_ramone.

Fijate si lo que estas buscando es algo como esto:
Código Delphi [-]
unit DBGridTitVert;

interface

uses Windows, Types, Graphics, Grids, DBGrids;

type
  TDBGrid = class(DBGrids.TDBGrid)
  private
    FColsHeight : Integer;
    procedure SetColsHeight(const Value: Integer);
  protected
    procedure DrawCell(ACol, ARow: Integer; ARect: TRect; State: TGridDrawState); override;
  public
    property ColsHeight: Integer read FColsHeight write SetColsHeight;
  end;

implementation

{ TDBGrid }
procedure TDBGrid.DrawCell(ACol, ARow: Integer; ARect: TRect;
  State: TGridDrawState);
var
  LF         : LOGFONT;
  CurrentCol : TColumn;
  FontName   : string;
begin
  if (ARow = FixedRows-1) and (ACol >= Integer(dgIndicator in Options)) then
  begin
    CurrentCol := Columns[ACol-1];
    FontName   := CurrentCol.Title.Font.Name;
    ZeroMemory(@LF, SizeOf(LF));
    LF.lfHeight        := Canvas.Font.Height ;
    LF.lfWidth         := Canvas.Font.Size;
    LF.lfEscapement    := 10 * 90;
    LF.lfCharSet       := CurrentCol.Font.Charset;
    Move(FontName, LF.lfFaceName, Length(FontName));
    Canvas.Brush.Color := CurrentCol.Title.Color;
    Canvas.Brush.Style := bsSolid;
    Canvas.FillRect(ARect);
    Canvas.Font.Handle:= CreateFontIndirect(LF);
    Canvas.TextOut(ARect.Left + (ARect.Right - ARect.Left) div 2 - LF.lfWidth,
      ARect.Bottom + LF.lfHeight, CurrentCol.Title.Caption);
  end
  else
    inherited;
end;

procedure TDBGrid.SetColsHeight(const Value: Integer);
begin
  if Value <> FColsHeight then
    if Value > 30 then // (el alto que consideres razonable)
    begin
      FColsHeight := Value;
      TStringGrid(self).DefaultRowHeight := Value;
    end;
end;

end.

Uso del ejemplo:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, ...,  DBGrids, DBGridTitVert; //  incluir último !!

...

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBGrid1.ColsHeight := 90;
end;
...

Muestra:


Saludos
__________________
Daniel Didriksen

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

Última edición por ecfisa fecha: 11-11-2015 a las 23:52:17.
Responder Con Cita
  #10  
Antiguo 11-11-2015
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.409
Poder: 22
fjcg02 Va camino a la fama
Ecfisa,

eres un puto maestro.


Saludos
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita
  #11  
Antiguo 11-11-2015
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
Hayyyy ¡ A cuantos le diras lo mismo !

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
  #12  
Antiguo 11-11-2015
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Poder: 15
AgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en brutoAgustinOrtu Es un diamante en bruto
No quiero ser aguafiestas, pero el amigo wil_ramone hablaba de un TStringGrid no de un TDBGrid



Cita:
es un stringGrid

este es el código que uso para los títulos

_verRporte.stgReportes.Cells[0,0]:='ZONA';
_verRporte.stgReportes.Cells[1,0]:='SUP. ZONA';
_verRporte.stgReportes.Cells[2,0]:='No.';
_verRporte.stgReportes.Cells[3,0]:='SITIO';
_verRporte.stgReportes.Cells[4,0]:='SUCURSAL';
_verRporte.stgReportes.Cells[5,0]:='FECHA DE REGISTRO';

es el que necesito que cambie de orientación

y este es el que utilizo para darle color desde el evento OnDrawCell

if (ARow=0) and (ACol<=5) then begin
Canvas.Brush.Color := clBlack;
canvas.Font.Style:=[FsBold];
canvas.Font.Color:=clWhite;
Canvas.TextRect(Rect, Rect.Left + 3, Rect.Top + 2, cells[Acol, Arow]);
Canvas.FrameRect(Rect);
end;
Responder Con Cita
  #13  
Antiguo 12-11-2015
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 Agustín.
Cita:
Empezado por AgustinOrtu Ver Mensaje
No quiero ser aguafiestas, pero el amigo wil_ramone hablaba de un TStringGrid no de un TDBGrid
Tenes razón , en ese caso:
Código Delphi [-]
unit SGTitVert;

interface

uses Windows, Types, Classes, Graphics, Grids;


type
  TStringGrid = class(Grids.TStringGrid)
  private
    FTitleHeight   : Integer;
    procedure SetTitleHeight(const Value: Integer);
  protected
    procedure DrawCell(ACol, ARow: Integer; ARect: TRect; State: TGridDrawState); override;
  public
    property TitleHeight: Integer read FTitleHeight write SetTitleHeight default 30;
  end;

implementation

procedure TStringGrid.DrawCell(ACol, ARow: Integer; ARect: TRect;
  State: TGridDrawState);
var
  LF         : LOGFONT;
  FontName   : string;
begin
  if ARow = FixedRows-1 then
  begin
    ZeroMemory(@LF, SizeOf(LF));
    LF.lfHeight        := Canvas.Font.Height ;
    LF.lfWidth         := Canvas.Font.Size;
    LF.lfEscapement    := 10 * 90;
    LF.lfCharSet       := DEFAULT_CHARSET;
    FontName           := Font.Name;
    Move(FontName, LF.lfFaceName, Length(FontName));
    Canvas.Brush.Color := FixedColor;
    Canvas.Brush.Style := bsSolid;
    Canvas.FillRect(ARect);
    Canvas.Font.Handle:= CreateFontIndirect(LF);
    Canvas.TextOut(ARect.Left + (ARect.Right - ARect.Left) div 2 - LF.lfWidth,
      ARect.Bottom + LF.lfHeight, Cells[ACol,ARow]);
  end
  else
    inherited;
end;

procedure TStringGrid.SetTitleHeight(const Value: Integer);
begin
  if Value <> FTitleHeight then
    if Value > 30 then
    begin
      FTitleHeight := Value;
      RowHeights[FixedRows-1] := Value;
    end;
end;

end.

Ejemplo de uso:
Código Delphi [-]
...

uses ..., SGTitVert; //  incluir último !!

type 
  TForm1 = class(...

...
implementation

procedure TForm1.FormCreate(Sender: TObject);
var
  sg: TStringGrid;
  s : string;
  c, r: Integer;
begin
  sg := StringGrid1;
  // los títulos de columna...
  for c := 0 to sg.ColCount-1 do  s := s + Format('Titulo%d,', [c+1]);
  sg.Rows[sg.FixedRows-1].DelimitedText := s;

  // cargar unos valores...
  for r := sg.FixedRows to sg.RowCount-1 do
    for c := 0 to sg.ColCount-1 do
      sg.Cells[c,r] := Format('Celda %d',[r+c])

  // alto de título
  sg.TitleHeight   := 90;
end;
...

Muestra:


Saludos
__________________
Daniel Didriksen

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

Última edición por ecfisa fecha: 12-11-2015 a las 00:49:06.
Responder Con Cita
  #14  
Antiguo 12-11-2015
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.409
Poder: 22
fjcg02 Va camino a la fama
Ecfisa,

eres el re-puto maestro. O el P.A. ( puto amo)

Y no. últimamente no se lo digo a casi nadie...

Gracias
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita
  #15  
Antiguo 12-11-2015
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 3.461
Poder: 20
newtron Va camino a la fama
Cita:
Empezado por fjcg02 Ver Mensaje
Ecfisa,

eres el re-puto maestro. O el P.A. ( puto amo)
Totalmente de acuerdo. Yo hasta le estoy cogiendo manía.
__________________
Be water my friend.
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
Excel - Encabezado shoulder Varios 2 14-02-2013 17:21:01
insertar registro en un grid que esta en otro grid @-Soft SQL 7 20-02-2008 17:22:42
la computacion grid en accion - world community grid nightynvid La Taberna 0 04-01-2007 17:33:44
Encabezado XML bumiga Internet 0 04-01-2006 16:33:28
Encabezado del reporte cmgenny Impresión 1 11-05-2003 09:54:36


La franja horaria es GMT +2. Ahora son las 21:02:59.


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