Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #11  
Antiguo 05-08-2010
[FGarcia] FGarcia is offline
Miembro Premium
 
Registrado: sep 2005
Ubicación: Cordoba, Veracruz, México
Posts: 1.123
Poder: 20
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
 



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 09:27:20.


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