Ver Mensaje Individual
  #2  
Antiguo 27-08-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Reputación: 23
José Luis Garcí Va camino a la fama
2ª parte del código

Código Delphi [-]
var VarIHeighAutoHEigt:Integer;

implementation

{ TPanelDiary }

procedure TMiPanelDiary.Alarm(Sender: TObject);
begin
    if Assigned(FOnAlarm) then FOnAlarm(Sender);
    if FClock.FMessageAlarm<>'' then ShowMessage(FClock.FMessageAlarm);
end;

procedure TMiPanelDiary.AutoDestroy;
begin
     FClock.Free;
     FClock.FFontClock.Free;
     FDay.FFontDay.Free;
     FDayExt.FFontDayExt.Free;
     FMonth.FFontMonth.Free;
     FStation.FFontStation.Free;
     FWeeksDays.FFontWeekDays.Free;
     FYear.FFontYear.Free;
     FPanelNotice.Free;
     FPanelStation.Free;
     FPanelDayExt.Free;
     FPanelDayX.Free;
     FPanelMonth.Free;
     FPanelYear.Free;
     FPanelWeeksDay.Free;
     FPanelClock.Free;
     FMyTimer.free;
     FTexto1.Free;
     FTexto2.Free;
end;

procedure TMiPanelDiary.AutoInitialize;
begin
     FOnlyOneFont                 := False;
     FDate                        := Now;
     FLanguage                    := Espanol;
     Height                       := 318;
     Width                        := 177;
     FUsarComentarios       := True;
     Ftipo                        := Completo;
     FAutoheight                  := False;
     //------------------------------------------------Notice
     FNotice                      := TNotice.Create;
     Fnotice.FNoticeColor         := clBlue;
     FNotice.FPanelVisible        := False;
     FNotice.FText1               := '';
     FNotice.FText2               := '';
     FNotice.Height               := 40;
     FNotice.FNoticeFont          := TFont.Create;
     with FNotice.FNoticeFont do
     begin
        Color                     := clYellow;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     //------------------------------------------------Estacion
     FStation                     := TStation.Create;
     FStation.FColorStation       := $0033CCFF;
     FStation.FPanelVisible       := True;
     FStation.FFontStation        := TFont.Create;
     with FStation.FFontStation do
     begin
        Color                     := $00CC3300;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     FStation.FColorStation       := clRed;
     //------------------------------------------------Dias Extendidos
     FDayExt                      := TDayExt.Create;
     FDayExt.FColorDayExt         := $0033CCFF;
     FDayExt.FPanelVisible        := True;
     FDayExt.FFontDayExt          := TFont.Create;
     with FDayExt.FFontDayExt do
     begin
        Color                     := $00CC3300;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     //------------------------------------------------Dia
     FDay                         := TDayX.Create;
     FDay.FColorDay               := clWhite;
     FDay.FHeight                 := 100;
     FDay.FFontDay                := TFont.Create;
     with FDay.FFontDay do
     begin
        Color                     := clBlack;
        Name                      := 'Arial';
        Size                      := 70;
        Style                     := [fsBold]
     end;
     //------------------------------------------------Mes
     FMonth                       := TMonth.Create;
     FMonth.FColorMonth           := $0033CCFF;
     FMonth.FPanelVisible         := True;
     FMonth.FFontMonth            := TFont.Create;
     with FMonth.FFontMonth do
     begin
        Color                     := $00CC3300;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     //------------------------------------------------Año
     FYear                        := TYear.Create;
     FYear.FColorYear             := $0033CCFF;
     FYear.FPanelVisible          := True;
     FYear.FFontYear              := TFont.Create;
     with FYear.FFontYear do
     begin
        Color                     := $00CC3300;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     //------------------------------------------------Semanas dias
     FWeeksDays                   := TWeeksDay.Create;
     FWeeksDays.FColorWeeksDays   := $0033CCFF;
     FWeeksDays.FPanelVisible     := True;
     FWeeksDays.FFontWeekDays     := TFont.Create;
     with FWeeksDays.FFontWeekDays do
     begin
        Color                     := $00CC3300;
        Name                      := 'Arial';
        Size                      := 12;
        Style                     := [fsBold]
     end;
     //-------------------------------------------------CLOCK
     FClock                   := TClock.Create;
     FClock.FClockEnable      := True;
     FClock.FPanelVisible     := True;
     FClock.FFontClock        := TFont.Create;
     FClock.FClock12_24       := Select12;
     FClock.FColorClock       := $00FFCCCC;
     FClock.FFontClock.color  := $00003333;
     FClock.FInterval         := 1000;
     FClock.FAlarmActive      := False;
     FClock.FHourAlarm        := Now;
     FClock.FMessageAlarm     := '';
     FClock.FHour             := Now;
     FMyTimer:=TTimer.Create(Self);     //-------------------------------------------------Timer
     with FMyTimer do
     begin
        Enabled     := FClock.FClockEnable;
        Interval    := FClock.FInterval;
        OnTimer     := FOnTimer;
     end;
     FPanelNotice:=TPanel.Create(Self); //------------------------------------------------Notice
     with FPanelNotice do
     begin
        Parent      := Self;
        TabOrder    := 0;
        Align       := alTop;
        Visible     := False;
        Font        := FNotice.FNoticeFont;
        Color       := FNotice.FNoticeColor;
        Visible     := FNotice.FPanelVisible;
        ParentColor :=false;
        ParentBackground :=False;
        Height      := FNotice.Height;
        Caption     :='';
     end;
     FTexto1:=TLabel.Create(Self);
     with FTexto1 do
     begin
        Parent     := FPanelNotice;
        Top        := 3;
        Left       := 3;
        AutoSize   := False;
        Width      := FPanelNotice.Width-6;
        Font       := FNotice.FNoticeFont;
        Transparent:= True;
        Alignment  := taCenter
     end;
     FTexto2:=TLabel.Create(Self);
     with FTexto2 do
     begin
        Parent     := FPanelNotice;
        Top        := 3+FNotice.FNoticeFont.Size+1;  //?? +/-
        Left       := 3;
        AutoSize   := False;
        Width      := FPanelNotice.Width;
        Font       := FNotice.FNoticeFont;
        Transparent:= True;
        Alignment  := taCenter
     end;
     FPanelDayExt:=TPanel.Create(Self); //------------------------------------------------Dia Extendido
     with FPanelDayExt do
     begin
        Parent      := Self;
        TabOrder    := 1;
        Align       := alTop;
        Font        := FDayExt.FontDayExt;
        Color       := FDayExt.FColorDayExt;
        Visible     := FDayExt.FPanelVisible;
        ParentColor := false;
        ParentBackground :=False;
        Height      := 30;
        Caption     :=' Dia ';
     end;
     FPaneldayx:=TPanel.Create(Self); //------------------------------------------------Dia
     with FPanelDayX do
     begin
        Parent      := Self;
        TabOrder    := 2;
        Align       := alTop;
        Font        := FDay.FFontDay;
        Color       := FDay.FColorDay;
        Caption     := FormatDateTime('dd',Date);
        ParentColor := false;
        ParentBackground :=False;
        Height      := FDay.FHeight;
     end;
     FPanelMonth:=TPanel.Create(Self); //------------------------------------------------Mes
     with FPanelMonth do
     begin
        Parent      := Self;
        TabOrder    := 3;
        Align       := alTop;
        Font        := FMonth.FFontMonth;
        Color       := FMonth.FColorMonth;
        Visible     := FMonth.FPanelVisible;
        ParentColor := false;
        ParentBackground :=False;
        Height      := 30;
        Caption     :='MES';
     end;
     FPanelYear:=TPanel.Create(Self); //------------------------------------------------Año
     with FPanelYear do
     begin
        Parent      := Self;
        TabOrder    := 4;
        Align       := alTop;
        Font        := FYear.FFontYear;
        Color       := FYear.FColorYear;
        Visible     := FYear.FPanelVisible;
        ParentColor := false;
        ParentBackground :=False;
        Height      := 30;
        Caption     :=' AÑO ';
     end;
     FPanelWeeksDay:=TPanel.Create(Self); //------------------------------------------------Semanas Dias
     with FPanelWeeksDay do
     begin
        Parent      := Self;
        TabOrder    := 5;
        Align       := alTop;
        Font        := FWeeksDays.FFontWeekDays;
        Color       := FWeeksDays.FColorWeeksDays;
        Visible     := FWeeksDays.FPanelVisible;
        ParentColor :=false;
        ParentBackground :=False;
        Height      := 30;
        Caption     :='Semanas Dias';
     end;

     FPanelStation:=TPanel.Create(Self); //------------------------------------------------Station
     with FPanelStation do
     begin
        Parent      := Self;
        TabOrder    := 6;
        Align       := alTop;
        Visible     := FStation.FPanelVisible;
        Font        := FStation.FFontStation;
        Color       := FStation.FColorStation;
        ParentColor :=false;
        ParentBackground :=False;
        Height      := 30;
        Caption     :=' ESTACION ';
     end;
     FPanelClock:=TPanel.Create(Self); //------------------------------------------------Reloj
     with FPanelClock do
     begin
        Parent      := Self;
        TabOrder    := 7;
        Align       := alTop;
        Font        := FClock.FFontClock;
        Color       := FClock.FColorClock;
        Visible     := FClock.FPanelVisible;
        ParentColor :=false;
        ParentBackground :=False;
        Visible     := True;
        Height      := 30;
        Caption     :='Reloj';
     end;
end;

procedure TMiPanelDiary.Calculos;
var VariNumeroPaneles:Integer;
begin { Calculamnos la estacion del año semanas y dias }
   VariNumeroPaneles:=1;
   if FNotice.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FDayExt.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FMonth.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FYear.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FWeeksDays.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FStation.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   if FClock.FPanelVisible then VariNumeroPaneles:=VariNumeroPaneles+1;
   VarIHeighAutoHEigt:=(Self.Height-FDay.FHeight) div (VariNumeroPaneles-1);
end;

procedure TMiPanelDiary.Click;
begin
  inherited Click;
end;

procedure TMiPanelDiary.ClickClock(Sender: TObject);
begin
    if Assigned(FOnClickClock) then FOnClickClock(Sender);
end;

procedure TMiPanelDiary.ClickDay(Sender: TObject);
begin
    if Assigned(FOnClickDay) then FOnClickDay(Sender);
end;

procedure TMiPanelDiary.ClickDayExt(Sender: TObject);
begin
    if Assigned(FOnClickDayExt) then FOnClickDayExt(Sender);
end;

procedure TMiPanelDiary.ClickMonth(Sender: TObject);
begin
    if Assigned(FOnClickMonth) then FOnClickMonth(Sender);
end;

procedure TMiPanelDiary.ClickNotice(Sender: TObject);
begin
    if Assigned(FOnClickNotice) then FOnClickNotice(Sender);
end;

procedure TMiPanelDiary.ClickStation(Sender: TObject);
begin
    if Assigned(FOnClickStation) then FOnClickStation(Sender);
end;

procedure TMiPanelDiary.ClickWeeksDays(Sender: TObject);
begin
    if Assigned(FOnClickWeeksDays) then FOnClickWeeksDays(Sender);
end;

procedure TMiPanelDiary.ClickYEar(Sender: TObject);
begin
    if Assigned(FOnClickYEar) then FOnClickYEar(Sender);
end;

constructor TMiPanelDiary.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  AutoInitialize;
end;

procedure TMiPanelDiary.DateChanged(Sender: TObject);
begin
    if Assigned(FOnDateChanged) then FOnDateChanged(Sender);
end;

destructor TMiPanelDiary.Destroy;
begin
     AutoDestroy;
     inherited Destroy;
end;

procedure TMiPanelDiary.Loaded;
begin
    inherited Loaded;
end;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita