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 05-08-2010
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 27
Caral Va por buen camino
Hola
Me alegra que te sirviera de algo.
Lo hice en un ratito, pero se pueden hacer muchas cosas con este componente.
Yo lo uso en mi sistema en varios form, sobre todo en el de facturacion.
Saludos
__________________
Siempre Novato
Responder Con Cita
  #2  
Antiguo 05-08-2010
[FGarcia] FGarcia is offline
Miembro Premium
 
Registrado: sep 2005
Ubicación: Cordoba, Veracruz, México
Posts: 1.123
Poder: 22
FGarcia Va por buen camino
Hice unas modificaciones para ver la rejilla como la necesito pero me he topado con problemas al dibujarla.

Del codigo anterior que puse modifique esta propiedad del StringGrid

Código Delphi [-]
//Este procedimiento alinea a la derecha el contenido de las celdas. Tambien da
//color a las columnas en el StringGrid 1
procedure TfrmCaptura.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var sCad: String;
    i: Integer;
begin
  //Aqui pinto las columnas "fijas"
  if (ACol = 0) or (Acol = 3) or (Acol = 6) then
    if ARow > 1 then
      If StringGrid1.Cells[ACol,ARow] <> '' Then
      begin
        sCad := StringGrid1.Cells[ACol,ARow];
        With StringGrid1 Do
          with Canvas,Rect do
            Begin
              Canvas.Brush.Style := bsSolid;
              case ACol of
                0: Canvas.Brush.Color := clMoneyGreen;
                3: Canvas.Brush.Color := clSkyBlue;
                6: Canvas.Brush.Color := clAqua;
              end;
              Canvas.FillRect(Rect);
              Canvas.TextOut(0,Top + 2,sCad);
            End;
      end;

  If (ACol=1) Or (ACol=2) Then
    if ARow > 1 then //No quiero alinear la línea de títulos
      If StringGrid1.Cells[ACol,ARow] <> '' Then
        Begin
          sCad := StringGrid1.Cells[ACol,ARow];
          With StringGrid1 Do
            with Canvas,Rect do
              Begin
                Canvas.Brush.Style := bsSolid;
                case ACol of
                  1: Canvas.Brush.Color := clYellow;
                  2: Canvas.Brush.Color := clRed;
                end;
                i:=Right-TextWidth(sCad + ' '); //Aqui se alinea a la derecha
                Canvas.FillRect(Rect);
                Canvas.TextOut(i,Top + 2,sCad);
              End;
        End;
end;

Una manita para ver por que no se redibuja correctamente.
Imágenes Adjuntas
Tipo de Archivo: jpg Rejilla2.jpg (37,9 KB, 59 visitas)
__________________
ESTO ES UN FORO ... NO UN MÓVIL
¿Por qué no escribir de una manera comprensible para que los humanos lo podamos entender?
Responder Con Cita
  #3  
Antiguo 05-08-2010
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.437
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Cita:
Empezado por FGarcia Ver Mensaje
Una manita para ver por que no se redibuja correctamente.
¿No entiendo qué es lo que te falta?
¿Se trata de que se dibuje como en la imagen que adjuntas?

Puedes automatizar las cosas; Por ejemplo, para rellenar las horas puedes usar algo así:

Código Delphi [-]
  // rellenar horas
  for i := 0 to 2 do begin
    // rellenar las horas
    for j := 0 to 8 do begin
      Str := Format('%.2d:00',[j+(i*8)]) + ' - ' + Format('%.2d:00',[(j+(i*8)+1) mod 24]);
      StringGrid1.Cells[i * 3, (j) + 2] := Str;
    end;
  end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.

Última edición por Neftali [Germán.Estévez] fecha: 05-08-2010 a las 11:03:04.
Responder Con Cita
  #4  
Antiguo 05-08-2010
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - España
Posts: 19.437
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Lo bueno del TStringGrid es que el pintado es relatívamente sencillo; POr ejemplo, para el tema de los títulos con algo de código en el evento OnDrawCell puedes conseguir algo así:



Código Delphi [-]
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  sCad: String;
  i: Integer;

  procedure _PaintTitle1(ACol:integer);
  var
    ATitle:string;
  begin

    if (ACol=0) or (ACol=1) or (ACol=2) then begin
      ATitle := 'Primer turno';
    end
    else if (ACol=3) or (ACol=4) or (ACol=5) then begin
      ATitle := 'Segundo turno';
    end
    else if (ACol=6) or (ACol=7) or (ACol=8) then begin
      ATitle := 'Tercer turno';
    end;

    InflateRect(Rect, -1, -2);

    StringGrid1.Canvas.Pen.Color := clBlack;
    StringGrid1.Canvas.Brush.Style := bsSolid;
    StringGrid1.Canvas.Brush.Color := $00E6E6E6;
    StringGrid1.Canvas.Rectangle(Rect);
    Application.ProcessMessages;
    StringGrid1.Canvas.TextOut(Rect.Left + 5,Rect.Top + 3, ATitle);
    Application.ProcessMessages;
  end;

  procedure _PaintTitle2(ACol:integer);
  var
    ATitle:string;
  begin

    if (ACol=0) or (ACol=3) or (ACol=6) then begin
      ATitle := 'Hora';
    end
    else if (ACol=1) or (ACol=4) or (ACol=7) then begin
      ATitle := 'Operaciones';
    end
    else if (ACol=2) or (ACol=5) or (ACol=8) then begin
      ATitle := 'Acumulado';
    end;

    InflateRect(Rect, -1, -2);

    StringGrid1.Canvas.Pen.Color := clBlack;
    StringGrid1.Canvas.Brush.Style := bsSolid;
    StringGrid1.Canvas.Brush.Color := $00E6E6E6;
    StringGrid1.Canvas.Rectangle(Rect);
    Application.ProcessMessages;
    StringGrid1.Canvas.TextOut(Rect.Left + 5,Rect.Top + 3, ATitle);
    Application.ProcessMessages;
  end;

begin

  StringGrid1.Options := StringGrid1.Options - [goFixedVertLine];

  if (ARow = 0) then begin
    if (ACol=0) or (ACol=3) or (ACol=6) then begin
      Rect.Right := Rect.Right + StringGrid1.ColWidths[ACol+1] + StringGrid1.ColWidths[ACol+2];
      _PaintTitle1(ACol);
    end;
    if (ACol=1) or (ACol=4) or (ACol=7) then begin
      Rect.Left := Rect.Left - StringGrid1.ColWidths[ACol-1];
      Rect.Right := Rect.Right - StringGrid1.ColWidths[ACol+1];
      Rect.Left := Rect.Left-1;
      _PaintTitle1(ACol);
    end;
    if (ACol=2) or (ACol=5) or (ACol=8) then begin
      Rect.Left := Rect.Left - StringGrid1.ColWidths[ACol-1] - StringGrid1.ColWidths[ACol-2];
      Rect.Left := Rect.Left-2;
      _PaintTitle1(ACol);
    end;
  end;

  if (ARow = 1) then begin
    _PaintTitle2(ACol);
  end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
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 en celda de otro stringgrid?? noodle_ OOP 3 17-06-2008 13:36:01
Tutorial muli MS SQL Server 3 15-05-2008 10:31:59
Tutorial jocey Conexión con bases de datos 1 06-11-2007 14:57:32
Tutorial .Net MaMu .NET 2 06-08-2007 19:40:15
Tutorial de POO AbcXxx OOP 3 06-02-2004 16:29:48


La franja horaria es GMT +2. Ahora son las 01:27:41.


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