设计一个IP地址输入框(0分)

  • 主题发起人 主题发起人 nutian
  • 开始时间 开始时间
N

nutian

Unregistered / Unconfirmed
GUEST, unregistred user!
几句代码就搞定了:

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;

够简单, 该有的都有了。[:)]


来自:smilboy, 时间:2002-2-3 15:52:00, ID:904104
按照楼上的方法

unit IPAddressEdit;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ComCtrls, CommCtrl,
StdCtrls;

type
TIPAddressEdit = class(TEdit)
private
{ Private declarations }
protected
procedure CreateParams(var Params: TCreateParams); override;
public
{ Public declarations }
published
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Liren.z', [TIPAddressEdit]);
end;

{ TIPAddressEdit }

procedure TIPAddressEdit.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
InitCommonControl(ICC_INTERNET_CLASSES);
CreateSubClass(Params, WC_IPADDRESS);
end;

end.
=============================================================================
动态创建个Edit怎么样?试试下面代码:
uses
..., CommCtrl, ComCtrls;

{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
InitCommonControl(ICC_INTERNET_CLASSES);
CreateWindow(WC_IPADDRESS,nil,WS_CHILD or WS_VISIBLE,20,20,130,23, Handle,0,
hInstance,nil);
end;

 
但我用时遇到问题了
我设置字体为宋体等中文字体
有些问题
没解决
只好还用英文的

代码很好
 
出问题了,不知道为什么,它总改变窗体的字体和其它控件尺寸,
实在令人头疼!
 
后退
顶部