Club Delphi  
    Paypal   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

Coloboración Paypal con ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-11-2015
Avatar de AgustinOrtu
[AgustinOrtu] AgustinOrtu is offline
Miembro Premium
NULL
 
Registrado: ago 2013
Ubicación: Argentina
Posts: 1.858
Poder: 17
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
  #2  
Antiguo 12-11-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
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
  #3  
Antiguo 12-11-2015
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.418
Poder: 24
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
  #4  
Antiguo 12-11-2015
Avatar de newtron
[newtron] newtron is offline
Membrillo Premium
 
Registrado: abr 2007
Ubicación: Motril, Granada
Posts: 4.215
Poder: 24
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 12:13:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi