Ver Mensaje Individual
  #5  
Antiguo 06-03-2008
spyfenix spyfenix is offline
Miembro
 
Registrado: mar 2007
Posts: 35
Reputación: 0
spyfenix Va por buen camino
Talking Listo, algo adornado si alguien le interesa

Que tal Caral
gracias por la ayuda, mira esta es la funcion cuando se crea el calendario, y le acabo de agregar que mientras se va creando va cargando informacion si hay alguna actividad en dicho dia.
Espero les guste

saludos

Código Delphi [-]
procedure TfrmPrincipal.CreaCalendario(const Fecha :TDateTime);
var
  Dias, cont, TheTop : Integer;
  Dia, aCelda : TfrmCelda;
  aNombre : String;
begin
  LockWindowUpdate(self.handle);
    TheTop:= 36;
    Dias := DaysInMonth(Fecha);// cuantos días tiene ese més?
    for cont := 1 to Dias  do
    begin
      dia := TfrmCelda.Create(frmPrincipal.tbCalendario);
      dia.Fecha := RecodeDay(fecha,cont); // asignamos la fecha y el caption de esa celda
      dia.Name := dia.Name + IntToStr(cont); // le ponemos un nombre irrepetible.
      dia.Left:= (DayOfTheWeek(dia.Fecha)-1) * dia.Width; // segun el dia de la semana y el ancho del Freame, lo situamos en pantalla.
      if dia.Left = 0 then
        TheTop := TheTop + dia.Height; // si el dia es 1 es Lunes, aumentamos el Top para la siguiente linea
      dia.Top := TheTop;
      dia.Parent:= frmPrincipal.tbCalendario; // lo hacemos visible en el Form
      //cargamos los datos segun corresponda la fecha
      frmPrincipal.ADOQuery2.Close;
      frmPrincipal.ADOQuery2.Parameters.ParamByName('An').Value := StrToInt(frmPrincipal.EAn.Text);
      frmPrincipal.ADOQuery2.Parameters.ParamByName('Me').Value := StrToInt(frmPrincipal.EMes.Text);
      frmPrincipal.ADOQuery2.Parameters.ParamByName('Di').Value := cont;
      frmPrincipal.ADOQuery2.Open;
      if frmPrincipal.ADOQuery2.RecordCount  > 0 then
      begin
        dia.Memo1.Text := ADOQuery2comentarios.Value;
      end;
      LockWindowUpdate(0);
   end;
end;
Responder Con Cita