Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 30-08-2011
ramonibk ramonibk is offline
Miembro
 
Registrado: may 2004
Posts: 193
Poder: 23
ramonibk Va por buen camino
Parece que esta no es la solución.

pues al ejecutar me da el error
"list index of bounds 1239256"

Os cuento mas o menos todo el proceso pare que me comentéis.

Tengo un procedimiento llamado calendario que es quie me pinta eso el calendario.
Código Delphi [-]
Procedure TForm1.Calendario;
var
 days : array[0..6] of string;
 i, iNumDays, iDay: Integer;
 iRowCtr, iColCtr: Integer;
 Fecha : String;
begin
 Fecha := '1/' + IntToStr(wMes) + '/' + IntToStr(wAnyo);
 DaysInMonth( StrToDate( Fecha ));
 days[0] := 'L';
 days[1] := 'M';
 days[2] := 'X';
 days[3] := 'J';
 days[4] := 'V';
 days[5] := 'S';
 days[6] := 'D';
 with StringGrid1 do
  begin
   for i := 0 to 6 do
    Cells[i, 0] := days[i]
  end;
 iNumDays := MonthDays[IsLeapYear(WAnyo), WMes]; // Numero de dias en el mes
 ShortDateFormat := 'dd/mm/yyyy';
 iDay := DayOfTheWeek(StrToDate(Fecha)); // En que dia de la semana estamos (1-7)

  If iDay = 7 Then // Si el primer dia de mes es domingo
   Begin
    StringGrid1.RowCount := 7;
   End Else
   Begin
    StringGrid1.RowCount := 6;
   End;
  If  iDay = 6  Then // Si el primer dia de mes es domingo
   Begin
     If iNumDays = 31 Then
       Begin
        StringGrid1.RowCount := 7;
       End;
   End Else
   Begin
    StringGrid1.RowCount := 6;
   End;

 iRowCtr := 1;
 iColCtr := iDay - 1;
  for i := 1 to iNumDays do
   begin
    StringGrid1.Cells[iColCtr, iRowCtr] := IntToStr(i);
    Inc(iColCtr);
    if iColCtr > 6 then
     begin
      iColCtr := 0;
      Inc(iRowCtr);
     end;
   end;
end;
Este procedimiento es cargado ne el create del form.
y releído cuando se varia de mes o año y a contibuacion en el OnDrawCell
Código Delphi [-]
with Sender as TStringGrid do
  begin
   if ACol = 6 Then // Los domingos los pintamos en rojo
    Begin
     Canvas.font.Color := clRed;
     Canvas.Font.Style := [fsBold];
    End;
   if gdFixed in State then // Fila superior Dias de la semana en azul
    begin
     Canvas.Brush.Color := clNavy;
     Canvas.Font.Color := clWhite;
     Canvas.Font.Style := [fsBold];
    end;
  if gdSelected in State then  // Celda seleccionada
     begin
       Canvas.Brush.Color := clRed;
       Canvas.Font.Color := clHighlightText;
       Canvas.Font.Style := [];
     end;
//************* Aqui marco los dias especiales ********//
 if ( StringGrid1.Cells[ACol,ARow]= '10' ) And (wMes=8) Then
     begin
       Canvas.Brush.Color := clYellow;
       Canvas.Font.Style := [fsBold];
     end;

 if ( StringGrid1.Cells[ACol,ARow]= '15' ) And (wMes=8) Then
     begin
       Canvas.Brush.Color := clYellow;
       Canvas.Font.Style := [fsBold];
     end;
//***********************************************//
   Canvas.FillRect(Rect);
   Canvas.TextRect(Rect, Rect.Left + (Rect.Right - Rect.Left - Canvas.TextWidth(Cells[ACol,ARow]) + 1)
                                      div 2, Rect.Top + 2, Cells[ACol,ARow]);
  end;
end;
}
y asta aqui todo es correcto, no hay errores y funciona correctamente.
pero cuando intento sustituir.
Código Delphi [-]
//************* Aqui marco los dias especiales ********//
 if ( StringGrid1.Cells[ACol,ARow]= '10' ) And (wMes=8) Then
     begin
       Canvas.Brush.Color := clYellow;
       Canvas.Font.Style := [fsBold];
     end;

 if ( StringGrid1.Cells[ACol,ARow]= '15' ) And (wMes=8) Then
     begin
       Canvas.Brush.Color := clYellow;
       Canvas.Font.Style := [fsBold];
     end;
//***********************************************//
Por
Código Delphi [-]
DecodeDate(StrToDate(ListaFechas.Strings[i]),nAno,nMes,nDia);
 For i := 0 To ListaFechas.Count -1 Do
  Begin
    Canvas.Brush.Color := clYellow;
    Canvas.Font.Style := [fsBold];
    ListBox1.Items.Add(ListaFechas.Strings[i]); //Para verificacion de datos a cargar
  End
he intentado ponerlo por delante de
Código Delphi [-]
with Sender as TStringGrid do
como indica ecfisa en el interior de pero no hay manera y lo único que veo es que el lixbox se vuelve loco
Por cierto también he echo que cuando lo haga de manera automática no lea la primera linea ya que al ser esta las letras de día de la semana es cuelga.
Responder Con Cita
 


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
Pintar celdas StringGrid cacu OOP 4 24-10-2007 17:22:21
Marcar varias celdas en un grid. Trisckel Varios 0 02-11-2006 17:46:31
StringGrid + celdas Makiley Varios 4 01-02-2006 13:01:15
combinar celdas de StringGrid VRO Varios 2 21-04-2005 08:02:16
Combinar Celdas Stringgrid MITOPE Varios 0 21-04-2004 07:03:27


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


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