unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, CommCtrl, StdCtrls;
type
TIpEdit = class(TEdit)
procedure CreateParams(var Params: TCreateParams); override;
end;
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
IpEdit: TIpEdit;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TIpEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
InitCommonControl(ICC_INTERNET_CLASSES);
CreateSubClass(Params, WC_IPADDRESS);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
IpEdit := TIpEdit.Create(self);
IpEdit.Parent := Self;
IpEdit.SetBounds(10,10,121,22);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
edit1.Text := IpEdit.Text;
end;
end.
uses
ComCtrls, CommCtrl;
TIpEdit = class(TEdit)
procedure CreateParams(var Params: TCreateParams); override;
end;
{ TIpEdit }
procedure TIpEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
InitCommonControl(ICC_INTERNET_CLASSES);
CreateSubClass(Params, WC_IPADDRESS);
end;
http://hi.baidu.com/lzj1981/blog/item/7835f5eddf0843c2b21cb171.html