Ver Mensaje Individual
  #11  
Antiguo 05-08-2010
[FGarcia] FGarcia is offline
Miembro Premium
 
Registrado: sep 2005
Ubicación: Cordoba, Veracruz, México
Posts: 1.123
Reputación: 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