S
smilboy
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Monitor;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TMonitor = class(TPanel)
private
FComputerName: string;
FComputerIP: string;
FOnLineTime: TDateTime;
//****My Procedure*************************
procedure SetComputerName(value: string);
procedure SetComputerIP(value: string);
procedure SetOnlineTime(value: TdateTime);
//****My Procedure*************************
protected
{ Protected declarations }
public
//****My Procedure*************************
constructor Create(AOwner: TComponent); override;
procedure Update2(picture: TBitmap);
//****My Procedure*************************
published
property ComputerName: string read FComputerName write SetComputerName;
property ComputerIP: string read FComputerIP write SetComputerIP;
property OnlineTime: TDateTime read FOnlineTime write SetOnlineTime;
end;
procedure Register;
implementation
constructor TMonitor.Create(AOwner: TComponent); //设置缺省值
begin
inherited Create(AOwner);
{ default values }
inherited;
ControlStyle := ControlStyle + [csOpaque];
FComputerIP := '0.0.0.0';
FComputerName := 'Comuter';
FOnlineTime := now;
Width := 200;
Height := 100;
end;
procedure TMonitor.SetComputerName(value: string);
begin
if value <> '' then FComputerName := value;
end;
procedure TMonitor.SetComputerIP(value: string);
begin
if value <> '' then FComputerIP := value;
end;
procedure TMonitor.SetOnlineTime(value: TdateTime);
begin
FOnlineTime := value;
end;
procedure TMonitor.Update2(picture: TBitmap);
begin
self.Repaint;
self.Canvas.StretchDraw(self.ClientRect, picture);
self.Canvas.FillRect(self.ClientRect);
self.Canvas.Brush.Style := bsclear;
self.Canvas.Font.Name := '宋体';
self.Canvas.Font.Size := 9;
self.Canvas.TextOut(18, 18, self.ComputerName);
self.Canvas.TextOut(18, 31, self.ComputerIP);
self.Canvas.TextOut(18, 44, Timetostr(self.OnlineTime));
end;
procedure Register;
begin
RegisterComponents('smilboy', [TMonitor]);
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TMonitor = class(TPanel)
private
FComputerName: string;
FComputerIP: string;
FOnLineTime: TDateTime;
//****My Procedure*************************
procedure SetComputerName(value: string);
procedure SetComputerIP(value: string);
procedure SetOnlineTime(value: TdateTime);
//****My Procedure*************************
protected
{ Protected declarations }
public
//****My Procedure*************************
constructor Create(AOwner: TComponent); override;
procedure Update2(picture: TBitmap);
//****My Procedure*************************
published
property ComputerName: string read FComputerName write SetComputerName;
property ComputerIP: string read FComputerIP write SetComputerIP;
property OnlineTime: TDateTime read FOnlineTime write SetOnlineTime;
end;
procedure Register;
implementation
constructor TMonitor.Create(AOwner: TComponent); //设置缺省值
begin
inherited Create(AOwner);
{ default values }
inherited;
ControlStyle := ControlStyle + [csOpaque];
FComputerIP := '0.0.0.0';
FComputerName := 'Comuter';
FOnlineTime := now;
Width := 200;
Height := 100;
end;
procedure TMonitor.SetComputerName(value: string);
begin
if value <> '' then FComputerName := value;
end;
procedure TMonitor.SetComputerIP(value: string);
begin
if value <> '' then FComputerIP := value;
end;
procedure TMonitor.SetOnlineTime(value: TdateTime);
begin
FOnlineTime := value;
end;
procedure TMonitor.Update2(picture: TBitmap);
begin
self.Repaint;
self.Canvas.StretchDraw(self.ClientRect, picture);
self.Canvas.FillRect(self.ClientRect);
self.Canvas.Brush.Style := bsclear;
self.Canvas.Font.Name := '宋体';
self.Canvas.Font.Size := 9;
self.Canvas.TextOut(18, 18, self.ComputerName);
self.Canvas.TextOut(18, 31, self.ComputerIP);
self.Canvas.TextOut(18, 44, Timetostr(self.OnlineTime));
end;
procedure Register;
begin
RegisterComponents('smilboy', [TMonitor]);
end;
end.