S
savenight
Unregistered / Unconfirmed
GUEST, unregistred user!
其实我都告诉你答案了,再看看下面的:
unit tempEdit1;
interface
uses
Classes, Forms, Controls,
ComCtrls, ExtCtrls, StdCtrls;
type
TMyUpDown = class(TCustomUpDown)
public
property Associate;
published
property AlignButton;
property Anchors;
// property Associate;
property ArrowKeys;
property Enabled;
property Hint;
property Min;
property Max;
property Increment;
property Constraints;
property Orientation;
property ParentShowHint;
property PopupMenu;
property Position;
property ShowHint;
property TabOrder;
property TabStop;
property Thousands;
property Visible;
property Wrap;
property OnChanging;
property OnChangingEx;
property OnContextPopup;
property OnClick;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
TMyEdit1 = class(TPanel)
private
FEdit: TEdit;
FUpDown: TMyUpDown;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Edit: TEdit read FEdit; // write FEdit;
property UpDown: TMyUpDown read FUpDown; // write FUpDown;
property BevelOuter default bvNone;
property BorderStyle default bsSingle;
property Width default 80;
property Height default 20;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('temp', [TMyEdit1]);
end;
{ TMyEdit1 }
constructor TMyEdit1.Create(AOwner: TComponent);
begin
inherited;
Caption := '';
BevelOuter := bvNone;
BorderStyle := bsSingle;
FEdit := TEdit.Create(Self);
FEdit.SetSubComponent(True);
FEdit.BorderStyle := bsNone;
FEdit.Height := 16;
FEdit.Width := 60;
FEdit.Parent := Self;
FUpDown := TMyUpDown.Create(Self);
FUpDown.SetSubComponent(True);
FUpDown.Parent := Self;
FUpDown.Associate := FEdit;
Width := 80;
Height := 20;
end;
destructor TMyEdit1.Destroy;
begin
FEdit.Free;
FUpDown.Free;
inherited;
end;
end.
unit tempEdit1;
interface
uses
Classes, Forms, Controls,
ComCtrls, ExtCtrls, StdCtrls;
type
TMyUpDown = class(TCustomUpDown)
public
property Associate;
published
property AlignButton;
property Anchors;
// property Associate;
property ArrowKeys;
property Enabled;
property Hint;
property Min;
property Max;
property Increment;
property Constraints;
property Orientation;
property ParentShowHint;
property PopupMenu;
property Position;
property ShowHint;
property TabOrder;
property TabStop;
property Thousands;
property Visible;
property Wrap;
property OnChanging;
property OnChangingEx;
property OnContextPopup;
property OnClick;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
TMyEdit1 = class(TPanel)
private
FEdit: TEdit;
FUpDown: TMyUpDown;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Edit: TEdit read FEdit; // write FEdit;
property UpDown: TMyUpDown read FUpDown; // write FUpDown;
property BevelOuter default bvNone;
property BorderStyle default bsSingle;
property Width default 80;
property Height default 20;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('temp', [TMyEdit1]);
end;
{ TMyEdit1 }
constructor TMyEdit1.Create(AOwner: TComponent);
begin
inherited;
Caption := '';
BevelOuter := bvNone;
BorderStyle := bsSingle;
FEdit := TEdit.Create(Self);
FEdit.SetSubComponent(True);
FEdit.BorderStyle := bsNone;
FEdit.Height := 16;
FEdit.Width := 60;
FEdit.Parent := Self;
FUpDown := TMyUpDown.Create(Self);
FUpDown.SetSubComponent(True);
FUpDown.Parent := Self;
FUpDown.Associate := FEdit;
Width := 80;
Height := 20;
end;
destructor TMyEdit1.Destroy;
begin
FEdit.Free;
FUpDown.Free;
inherited;
end;
end.