📄 ucalend.pas
字号:
unit Ucalend;
interface
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, ComCtrls, Grids, Calendar;
type
TCalendario_form = class(TForm)
ok_but: TBitBtn;
Cancel_but: TBitBtn;
Panel1: TPanel;
Calendario: TMonthCalendar;
{procedure FormCreate(Sender: TObject);
procedure BarraMeseChange(Sender: TObject);
procedure BarraAnnoChange(Sender: TObject);
procedure oggi_butClick(Sender: TObject);
procedure CalendarioChange(Sender: TObject);}
private
{ Private declarations }
//Procedure AggiornaCalend ;
public
{ Public declarations }
//Function Settimana(anno,mese,giorno : integer) : integer ;
end;
var
Calendario_form: TCalendario_form;
implementation
{$R *.DFM}
{Function TCalendario_form.Settimana(anno,mese,giorno : integer) : integer ;
Var
Mesi : Array[1..12] of integer ;
Settimana,i : integer ;
GiornoSettimana,giorni : integer ;
Begin
// DA FARE
Mesi[1] := 31 ;
Mesi[2] := 28 ;
Mesi[3] := 31 ;
Mesi[4] := 30 ;
Mesi[5] := 31 ;
Mesi[6] := 30 ;
Mesi[7] := 31 ;
Mesi[8] := 31 ;
Mesi[9] := 30 ;
Mesi[10]:= 31 ;
Mesi[11]:= 30 ;
Mesi[12]:= 31 ;
If (Anno/4) = Int(Anno/4) Then
Mesi[2] := 29 ;
giorni := giorno ;
If mese > 1 then
for i:= 2 to mese do
begin
giorni := giorni + Mesi[i-1] ;
end ;
giornoSettimana := DayOfWeek(EncodeDate(Anno,1,1)) -1 ;
Settimana := Trunc((giorni + giornoSettimana)/7) ;
result := Settimana ;
end ;
Procedure TCalendario_form.AggiornaCalend ;
begin
GruppoCalendario.Caption := IntToStr(Calendario.Day) + '/' +
IntToStr(Calendario.Month) + '/' +
IntToStr(Calendario.Year) ;
end ;
procedure TCalendario_form.FormCreate(Sender: TObject);
Var
Anno : integer ;
begin
AggiornaCalend ;
Anno := Calendario.Year ;
BarraAnno.Max := Calendario.Year + 5 ;
BarraAnno.Min := Calendario.Year - 5 ;
BarraAnno.Position := Anno ;
BarraMese.Position := Calendario.Month ;
Oggi_but.Caption := IntToStr(Calendario.Day) + '/' +
IntTostr(Calendario.Month) + '/' +
IntToStr(Calendario.Year) ;
anno_min.Caption := IntToStr(BarraAnno.Min) ;
anno_max.Caption := IntToStr(BarraAnno.Max) ;
end;
procedure TCalendario_form.BarraMeseChange(Sender: TObject);
begin
Calendario.Month := BarraMese.Position ;
AggiornaCalend ;
end;
procedure TCalendario_form.BarraAnnoChange(Sender: TObject);
begin
Calendario.Year := BarraAnno.Position ;
AggiornaCalend ;
end;
procedure TCalendario_form.oggi_butClick(Sender: TObject);
Var
Anno,Mese,Giorno : word ;
begin
DecodeDate(Now,Anno,Mese,Giorno) ;
Calendario.Day := Giorno ;
Calendario.Month := Mese ;
Calendario.Year := anno ;
end;
procedure TCalendario_form.CalendarioChange(Sender: TObject);
begin
AggiornaCalend ;
end; }
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -