📄 ipaddress.pas
字号:
unit IpAddress;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, CommCtrl, ComCtrls, Controls,
Forms, Dialogs;
type
TIpAddress = class(TWinControl)
private
{ Private declarations }
FIPValue:DWORD;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure DestroyWnd; override;
//procedure WMSize(var Message:TWMSize);Message WM_SIZE;
public
constructor Create(AOwner: TComponent); override;
procedure SetIPValue(Value:DWORD);
procedure Clear;
published
{ Published declarations }
property Align;
property Anchors;
property BorderWidth;
property Color;
property Font;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Hint;
property Constraints;
property ParentShowHint;
property IPValue:DWORD read FIPValue write SetIPValue;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
procedure Register;
implementation
procedure TIpAddress.CreateParams(var Params:TCreateParams);
begin
Inherited CreateParams(Params);
CreateSubclass(Params,WC_IPADDRESS);
end;
procedure TIpAddress.CreateWnd;
begin
Inherited CreateWnd;
end;
procedure TIpAddress.DestroyWnd;
begin
Inherited DestroyWnd;
end;
constructor TIpAddress.Create(AOwner: TComponent);
begin
InitCommonControl(ICC_INTERNET_CLASSES);
Inherited Create(AOwner);
Height:=24;
Width:=120;
FIPValue:=0;
end;
{
procedure TIpAddress.WMSize(var Message:TWMSize);
begin
if HandleAllocated then
begin
Inherited;
SendMessage(Handle,IPM_SETADDRESS,0,FIPValue);
end;
end;
}
procedure TIpAddress.SetIPValue(Value:DWORD);
begin
if Value<>FIPValue then
begin
FIPValue:=Value;
SendMessage(Handle,IPM_SETADDRESS,0,Value);
end;
end;
procedure TIpAddress.Clear;
begin
SendMessage(Handle,IPM_CLEARADDRESS,0,0);
end;
procedure Register;
begin
RegisterComponents('Gan', [TIpAddress]);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -