N
Neco
Unregistered / Unconfirmed
GUEST, unregistred user!
unit TimeLabel;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
StdCtrls,ExtCtrls;
type
TTimeLabel = class(TCustomLabel)
private
obj_Timer:TTimer;
function GetActive:boolean ;
procedure SetActive (value:boolean);
protected
procedure UpdateClock(Sender: TObject);
public
{ Public declarations }
Constructor create(AOwner:Tcomponent);override;
published
property Align;
property Alignment;
property Color;
property Font;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Transparent;
property Visible;
property active :boolean read getactive write setactive; //default true;
end;
procedure Register;
implementation
Constructor TTimeLabel.create(AOwner:Tcomponent);
begin
inherited create(aowner);
// Create the internal timer object .
obj_timer:=TTimer.create(self);
obj_timer.OnTimer :=UpdateClock;
obj_timer.Enabled :=false;
end;
procedure TTimeLabel.UpdateClock(Sender: TObject);
begin
// Set the current time as caption .
caption:=FormatDateTime('dddd, mmmm d, yyyy,hh:mm AM/PM',date);
//caption:=timetostr(time);
end;
function TTimeLabel.GetActive():boolean ;
begin
result:=active;
end;
procedure TTimeLabel.SetActive (value:boolean);
begin
obj_timer.Enabled :=value;
end;
procedure Register;
begin
RegisterComponents('Standard', [TTimeLabel]);
end;
end.
///是个时间显示控件,可我安装到delphi5。0使用时报错“Stack overflow"
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
StdCtrls,ExtCtrls;
type
TTimeLabel = class(TCustomLabel)
private
obj_Timer:TTimer;
function GetActive:boolean ;
procedure SetActive (value:boolean);
protected
procedure UpdateClock(Sender: TObject);
public
{ Public declarations }
Constructor create(AOwner:Tcomponent);override;
published
property Align;
property Alignment;
property Color;
property Font;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Transparent;
property Visible;
property active :boolean read getactive write setactive; //default true;
end;
procedure Register;
implementation
Constructor TTimeLabel.create(AOwner:Tcomponent);
begin
inherited create(aowner);
// Create the internal timer object .
obj_timer:=TTimer.create(self);
obj_timer.OnTimer :=UpdateClock;
obj_timer.Enabled :=false;
end;
procedure TTimeLabel.UpdateClock(Sender: TObject);
begin
// Set the current time as caption .
caption:=FormatDateTime('dddd, mmmm d, yyyy,hh:mm AM/PM',date);
//caption:=timetostr(time);
end;
function TTimeLabel.GetActive():boolean ;
begin
result:=active;
end;
procedure TTimeLabel.SetActive (value:boolean);
begin
obj_timer.Enabled :=value;
end;
procedure Register;
begin
RegisterComponents('Standard', [TTimeLabel]);
end;
end.
///是个时间显示控件,可我安装到delphi5。0使用时报错“Stack overflow"