目前我不知道,不过我都是自己写!
给你一点启发:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, DBGrids;
type
TmyEdit = class(TEdit)
private
FOnEnter: TNotifyEvent;
FOnExit: TNotifyEvent;
AForm:TForm;
FGrid: TCustomGrid;
procedure CMEnter(var Message: TCMEnter); message CM_ENTER;
procedure CMExit(var Message: TCMExit); message CM_EXIT;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
property OnExit: TNotifyEvent read FOnExit write FOnExit;
end;
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TmyEdit }
procedure TmyEdit.CMEnter(var Message: TCMEnter);
begin
//定义位置,窗口大小 Visible:=True;
end;
procedure TmyEdit.CMExit(var Message: TCMExit);
begin
//Visible:=False;如果是窗口要hide
end;
constructor TmyEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
AForm:=TForm.Create(nil);
AForm.Visible:=false;
FGrid:=TCustomGrid.Create(nil);
FGrid.Parent:=Aform;
FGrid.Align:=alclient;
//你可以用窗口停靠
//如果是窗口要hide
//创建Grid,Visible为false
end;
destructor TmyEdit.Destroy;
begin
if Assigned(FGrid) then
FGrid.Free;
if Assigned(AForm) then
FreeAndNil(AForm);
inherited;
end;
end.