Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 27-11-2007
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Poder: 31
Lepe Va por buen camino
Esa imagen que pones tiene toda la pinta de ser un JFControls, un grid muy tuneable. Son componentes de pago.

Buscando por mis bibliotecas he encontrado una forma "fácil" de usar el método de fjcg02. Copia todo en una nueva unidad y ponle el nombre lpCanvas.pas:
Código Delphi [-]
unit lpCanvas;

interface
  uses Graphics,windows;

type TAlignText = (atTopLeft=0, atTopCenter, atTopRight,
                   atCenterLeft, atCenter, atCenterRight,
                   atBottomLeft, atBottomCenter, atBottomRight);

procedure PaintText(ACanvas: TCanvas; const ARect: TRect;
                       const Line:string; Align:TAlignText;
                       const FillBackground:Boolean = false);

implementation

uses sysutils;

const
 Offset = 2;

procedure PaintText(ACanvas: TCanvas; const ARect: TRect;
                       const Line:string; Align:TAlignText;
                       const FillBackground:Boolean = false);
var x,y,CenterX, CenterY:integer;
   Options :integer;
   S: array[0..255] of Char;
begin
  Options := ETO_CLIPPED;

  if FillBackground  then
    Options := options or ETO_OPAQUE;

  with ARect, Acanvas do
  begin
    CenterY := (Bottom - Top - TextHeight(Line)) div 2;
    CenterX := (Right - Left - TextWidth(line)) div 2;
    x:= Offset;
    y:= Offset;
    case Align of
     atTopLeft      :begin
                      x := left + Offset ;
                     end;
     atTopCenter    :begin
                      x := left + CenterX;
                     end;
     atTopRight     :begin
                      x := Right - Offset - TextWidth(Line);
                     end;
     atCenterLeft   :begin
                      x:= Left+ Offset;
                      y:= CenterY;
                     end;
     atCenter       :begin
                      x:= CenterX;
                      y:= CenterY;
                     end;
     atCenterRight  :begin
                      x:= Right - Textwidth(line) - Offset;
                      y:=  CenterY;
                     end;
     atBottomleft   :begin
                      y:=  Bottom - Textheight(Line) - Offset;
                     end;
     atBottomCenter :begin
                      x:= CenterX;
                      y:= Bottom - Offset - Textheight(Line);
                     end;
     atBottomRight  :begin
                      x:= Right - TextWidth(line) - Offset;
                      y:= Bottom - Textheight(Line)-Offset;
                     end;
    end;
    ExtTextOut(Handle, x, y, options,@ARect,  StrPCopy(S,Line),length(line),nil);
  end;
end;


end.

Forma de uso:
Código Delphi [-]
uses lpCanvas;

// Al dbGrid, le pones a false la propiedad DefaultDrawing
//En el evento OnDrawColumnCell del grid, escribes:
PaintText(Canvas, Rect,                      //parámetros del propio evento OnDrawColumnCell
             'Mi texto Linea1', atTopLeft,
             true); // aqui decimos que pinte el fondo

PaintText(Canvas, Rect,                      //parámetros del propio evento OnDrawColumnCell
             'Mi texto Linea 2', atBottomRight,  //segunda línea alineada a la derecha
             False); // Ahora no pintamos el fondo, porque se borraría la primera línea.

Como ves tienes 9 formas de alinear texto dentro de la celda, más que suficiente .

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.

Última edición por Lepe fecha: 27-11-2007 a las 20:06:15.
Responder Con Cita
 



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
Escribir en dbgrid, pero no guardar drykea Varios 10 02-08-2007 16:28:19
Como controlar los renglones de un dbGRID. Gangster Conexión con bases de datos 3 17-01-2007 22:28:05
select de campos de mismo registro pero no nulos Citlalli SQL 3 14-06-2006 02:37:27
Se puede mostrar Memo en Dbgrid pero sin campor persistentes? Alfredo OOP 0 23-01-2006 18:38:14
Pintar Renglones en DBGRID Enan0 SQL 2 15-02-2005 20:39:05


La franja horaria es GMT +2. Ahora son las 13:49:57.


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