我的想法是做一个控件,在里面放上一个编辑筐和一个按钮,但是设计时可见,运行时不见
unit MyPanel;interfaceuses
SysUtils, Classes, Controls, ExtCtrls,Buttons,StdCtrls;type
TMyPanel = class(TPanel)
private
Begin_No: TEdit;
B_Ok: TBitBtn;
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('xiaoxu', [TMyPanel]);
end;
constructor TMyPanel.Create(Owner: TComponent);
begin
inherited Create(Owner);
Begin_No:=TEdit.Create(self);
B_Ok:=TBitBtn.Create(self);
Begin_No.Parent:=self;
B_Ok.Parent:=self;
Begin_No.Left:=73;
Begin_No.Top:=1;
Begin_No.Width:=121;
Begin_No.Height:=21;
Begin_No.Visible:=true;
B_Ok.Left:=1;
B_Ok.Top:=1;
B_Ok.Width:=75;
B_Ok.Height:=25;
B_Ok.Visible:=true;
B_Ok.Kind:=bkOK;
Caption:='';
Height:=25;
AutoSize:=true;
end;
destructor TMyPanel.Destroy;
begin
Begin_No.Free;
B_Ok.Free;
inherited;
end;end.
unit MyPanel;interfaceuses
SysUtils, Classes, Controls, ExtCtrls,Buttons,StdCtrls;type
TMyPanel = class(TPanel)
private
Begin_No: TEdit;
B_Ok: TBitBtn;
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('xiaoxu', [TMyPanel]);
end;
constructor TMyPanel.Create(Owner: TComponent);
begin
inherited Create(Owner);
Begin_No:=TEdit.Create(self);
B_Ok:=TBitBtn.Create(self);
Begin_No.Parent:=self;
B_Ok.Parent:=self;
Begin_No.Left:=73;
Begin_No.Top:=1;
Begin_No.Width:=121;
Begin_No.Height:=21;
Begin_No.Visible:=true;
B_Ok.Left:=1;
B_Ok.Top:=1;
B_Ok.Width:=75;
B_Ok.Height:=25;
B_Ok.Visible:=true;
B_Ok.Kind:=bkOK;
Caption:='';
Height:=25;
AutoSize:=true;
end;
destructor TMyPanel.Destroy;
begin
Begin_No.Free;
B_Ok.Free;
inherited;
end;end.
解决方案 »
- 请教CALL注入工具原理。如果把文本框输入的汇编让DELPHI调用
- Query1.ParamByName传值问题。请求大家帮助。
- 如何用命令中斷for 語句的循環。
- 出错了,撑不住了。。。请各位大虾帮帮忙。。。
- 欲求三层的简单的实例(可加到100分)
- 怎么用ClientSocket、ServerSocket进行局域网广播啊?
- 我这里有能够屏蔽win2000的ctrl+alt+delete 的源码//
- 不在同一局域网的服务器与客户机的MIDAS连接,详细请看!
- 求救!关于masterfields
- 在DEPHI中如何提高TEXTOUT的效率?
- 如何把一个窗体内的Edit全部清空。在线等
- 在delphi 7 中 如何 获得 局域网内当前正在使用的计算机信息?
SysUtils, Classes, Controls, ExtCtrls,Buttons,StdCtrls;type
TMyPanel = class(TPanel)
private
Begin_No: TEdit;
B_Ok: TBitBtn;
procedure myeditchange(Sender: TObject);
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('xiaoxu', [TMyPanel]);
end;
procedure TMyPanel.myeditchange(Sender: TObject);
begin
self.Update;end;
constructor TMyPanel.Create(Owner: TComponent);
begin
inherited Create(Owner);
Begin_No:=TEdit.Create(self);
B_Ok:=TBitBtn.Create(self);
Begin_No.Parent:=self;
B_Ok.Parent:=self;
Begin_No.Left:=73;
Begin_No.Top:=1;
Begin_No.Width:=121;
Begin_No.Height:=21;
Begin_No.Visible:=true;
Begin_No.OnChange:=myeditchange;
B_Ok.Left:=1;
B_Ok.Top:=1;
B_Ok.Width:=75;
B_Ok.Height:=25;
B_Ok.Visible:=true;
B_Ok.Kind:=bkOK;
Caption:='';
Height:=25;
AutoSize:=true;
self.Update;
end;
destructor TMyPanel.Destroy;
begin
Begin_No.Free;
B_Ok.Free;
inherited;
end;end.
begin
inherited Create(Owner);
...........
Begin_No.Height:=21;
Begin_No.Visible:=true;
Begin_no.update
......
b_ok.update
....
end
SysUtils, Classes, Controls, ExtCtrls,Buttons,StdCtrls;type
TMyPanel = class(TPanel)
private
Begin_No: TEdit;
B_Ok: TBitBtn;
procedure myeditchange(Sender: TObject);
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(Owner: TComponent); override;
destructor Destroy; override;
procedure Update;override;
{ Public declarations }
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('xiaoxu', [TMyPanel]);
end;
procedure TMyPanel.myeditchange(Sender: TObject);
begin
self.Update;end;
procedure TMyPanel.Update;
begin
inherited ;
Begin_No.Update;
B_Ok.Update;
end;
constructor TMyPanel.Create(Owner: TComponent);
begin
inherited Create(Owner);
Begin_No:=TEdit.Create(self);
B_Ok:=TBitBtn.Create(self);
Begin_No.Parent:=self;
B_Ok.Parent:=self;
Begin_No.Left:=73;
Begin_No.Top:=1;
Begin_No.Width:=121;
Begin_No.Height:=21;
Begin_No.Visible:=true;
Begin_no.update;
Begin_No.OnChange:=myeditchange;
B_Ok.Left:=1;
B_Ok.Top:=1;
B_Ok.Width:=75;
B_Ok.Height:=25;
B_Ok.Visible:=true;
B_Ok.Update;
B_Ok.Kind:=bkOK;
Caption:='';
Height:=25;
AutoSize:=true;
self.Update;
end;
destructor TMyPanel.Destroy;
begin
Begin_No.Free;
B_Ok.Free;
inherited;
end;end.
你这个是控件代码,那你的使用这个控件的程序的代码是怎么样的?
xp+dephi7,就是设计时可见,运行时不可见,气死我了,你的配置是?
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
MyPanel1: TMyPanel;
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}end.
建议你重装Delhpi吧