1过程里的(sender:Tobject)是什么意思?还有在过程里定义的参数和我们自己定义的变量有什么区别?
(大家不要笑 我们的老师是智力有问题我是自学的)
2with sender as TSQLmonitor什么意思??with语句的作用??详解以下!
3 overload是什么意思还有reintroduce是什么??
4 这是关键明天要交了 是一个组件我认为是use语句的错单就是找不出来 大家帮帮我谢谢了分不够再嫁!!!
uses
SysUtils, Classes, Controls,XMLDOM,Graphics;TEditButton=class(TWinControl)
private
FButton:TButton;
FEdit:TEdit;
{ Private declarations }
protected
procedure WMSize(var Message:TWMSize);mesage WM_SIZE;
procedure SetText(Value:String);
Function GetText:String;
Function GetFont:TFont;
procedure SetFont(Value:TFont);
Function GetOnButtonClick:TNotifyEvent;
procedure setOnButtonClick(Value:TNotfityEvent);
{ Protected declarations }
public
Constructor Create(AOwner:TComponent);override;
Destructor Destroy;override; { Public declarations }
published
{ Published declarations }
Property Text:String read GetText write SetText;
Property Font:TFont read GetFont write SetFont;
Property OnButtonClick:TNotifyEvent read GetOnButtonClick write SetOnButtonClick;
procedure Register;implementationprocedure Register;
begin
RegisterComponents('ActiveX', [TWinControl1]);
end;
constructor TEditButton.create(AOwer:TComponent);
begin
inherited Create(AOwner);
FEdit:=TEdit.Create(self);
FEdit.parent:=self;
FEdit.Height:=21;
FButton:=TButton.create(self);
FButton.Left:=FEdit.Width;
FButton.Height:=19;
FButton.Width:=19;
FButton.Caption:='...';
FButton.Parent:=self;
Width:=FEdit.Width+FButton.Width;
Height:=FEdit.Height;
end;
destructor TEditButton1.Destroy;
begin
FEdit.Free;
FButton.Free;
inherited destroy;
end;
fuction TEditButton1.GetText:string;
begin
Result:=FEdit.Text;
end;
procedure TEditButton1.setText(Value:String);
begin
FEdit.Text:=value;
end;
fuction TEditButton.GetFont:TFont;
begin
Result:=FEdit.Font;
end;
procedure TEditButton.SetFont(Value:TFont);
begin
if Assigned(FEdit.Font)then
FEdit.font.Assign(Value);
end;
fuction TEditButton.GetOnButtonClick:TNotifyEvent;
begin
Result:=FButton.onClick;
end;
procedure TEditButton1.SetOnButtonClick(value:tNotifyEvent);
begin
FButton.OnClick:=value;
end;
(大家不要笑 我们的老师是智力有问题我是自学的)
2with sender as TSQLmonitor什么意思??with语句的作用??详解以下!
3 overload是什么意思还有reintroduce是什么??
4 这是关键明天要交了 是一个组件我认为是use语句的错单就是找不出来 大家帮帮我谢谢了分不够再嫁!!!
uses
SysUtils, Classes, Controls,XMLDOM,Graphics;TEditButton=class(TWinControl)
private
FButton:TButton;
FEdit:TEdit;
{ Private declarations }
protected
procedure WMSize(var Message:TWMSize);mesage WM_SIZE;
procedure SetText(Value:String);
Function GetText:String;
Function GetFont:TFont;
procedure SetFont(Value:TFont);
Function GetOnButtonClick:TNotifyEvent;
procedure setOnButtonClick(Value:TNotfityEvent);
{ Protected declarations }
public
Constructor Create(AOwner:TComponent);override;
Destructor Destroy;override; { Public declarations }
published
{ Published declarations }
Property Text:String read GetText write SetText;
Property Font:TFont read GetFont write SetFont;
Property OnButtonClick:TNotifyEvent read GetOnButtonClick write SetOnButtonClick;
procedure Register;implementationprocedure Register;
begin
RegisterComponents('ActiveX', [TWinControl1]);
end;
constructor TEditButton.create(AOwer:TComponent);
begin
inherited Create(AOwner);
FEdit:=TEdit.Create(self);
FEdit.parent:=self;
FEdit.Height:=21;
FButton:=TButton.create(self);
FButton.Left:=FEdit.Width;
FButton.Height:=19;
FButton.Width:=19;
FButton.Caption:='...';
FButton.Parent:=self;
Width:=FEdit.Width+FButton.Width;
Height:=FEdit.Height;
end;
destructor TEditButton1.Destroy;
begin
FEdit.Free;
FButton.Free;
inherited destroy;
end;
fuction TEditButton1.GetText:string;
begin
Result:=FEdit.Text;
end;
procedure TEditButton1.setText(Value:String);
begin
FEdit.Text:=value;
end;
fuction TEditButton.GetFont:TFont;
begin
Result:=FEdit.Font;
end;
procedure TEditButton.SetFont(Value:TFont);
begin
if Assigned(FEdit.Font)then
FEdit.font.Assign(Value);
end;
fuction TEditButton.GetOnButtonClick:TNotifyEvent;
begin
Result:=FButton.onClick;
end;
procedure TEditButton1.SetOnButtonClick(value:tNotifyEvent);
begin
FButton.OnClick:=value;
end;
解决方案 »
- 切割原料的数学建模编程算法问题
- delphi 写的dll 和java交互 问题
- 如何把DBGrid里的1000条记录快速保存为一份Excel文件?谢谢
- zlib的问题
- 怎么样减少对内存的占用
- 关于临时表查询出来的一个“时间日期”字段的处理?请有经验的同志帮忙。
- 高手请进!!!!!
- 急啊在线等(怎么把子EDIT控件文字靠右对齐)?
- 一个关于用Delphi编写.net系统的问题!
- 是不是安装上delphi6.0,有关visibroker and com+的编程环境都设置好了,为什么use orbpas老出错呢?
- ◆◆◆◆◆◆ 警惕福建骗子的笔记本伎俩!◆◆◆◆◆◆
- XML和FLASH通讯的问题!!
2.把组件作为tmonitor来使用,with是告诉你使用什么组件;
3.贴出错误代码提示
2、如果一个变量有多个属性,定义变量的各项值,你又不愿一一写出,可用
with **
begin
end;语句,例如:
with Edit1 do
begin
text:='aa';
font.color:=clblue;
end;
3、overload 重载函数
能不能给出错误提示或者整个代码
1、Sender:TObject 中的Sender就是这个方法的接受者
2、with sender as TSQLmonitor 这一句其实应该是:
with (sender as TSQLmonitor) do begin ... end;
好处是程序会在这里得到sender的地址,而其中的变量将在其基础上得到偏移量,
避免了频繁的寻找sender的地址,同时使代码看起来更清晰
3、没什么好说的
4、还没看
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons;type TButtonEdit = class(TWinControl)
private
FButton: TButton;
FEdit: TEdit;
protected
procedure WMSize(var Message: TWMSize); message WM_SIZE;
procedure SetText(Value: String);
function GetText: String;
function GetFont: TFont;
procedure SetFont(Value: TFont);
function GetOnButtonClick: TNotifyEvent;
procedure SetOnButtonClick(Value: TNotifyEvent);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Text: String read GetText write SetText;
property Font: TFont read GetFont write SetFont;
property OnButtonClick: TNotifyEvent read GetOnButtonClick write SetOnButtonClick;
end;procedure Register;implementationprocedure TButtonEdit.WMSize(var Message: TWMSize);
begin
inherited;
FEdit.Width := Message.Width-FButton.Width;
FButton.Left := FEdit.Width;
end;constructor TButtonEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FEdit := TEdit.Create(Self);
FEdit.Parent := self;
FEdit.Height := 21;
FEdit.Width:=20;
FButton := TButton.Create(Self);
FButton.Left := FEdit.Width;
FButton.Height := 19;
FButton.Width := 19;
FButton.Caption := '...';
FButton.Parent := Self; Width := FEdit.Width+FButton.Width;
Height := FEdit.Height;
end;destructor TButtonEdit.Destroy;
begin
FButton.Free;
FEdit.Free;
inherited Destroy;
end;function TButtonEdit.GetText: String;
begin
Result := FEdit.Text;
end;procedure TButtonEdit.SetText(Value: String);
begin
FEdit.Text := Value;
end;function TButtonEdit.GetFont: TFont;
begin
Result := FEdit.Font;
end;procedure TButtonEdit.SetFont(Value: TFont);
begin
if Assigned(FEdit.Font) then
FEdit.Font.Assign(Value);
end;function TButtonEdit.GetOnButtonClick: TNotifyEvent;
begin
Result := FButton.OnClick;
end;procedure TButtonEdit.SetOnButtonClick(Value: TNotifyEvent);
begin
FButton.OnClick := Value;
end;procedure Register;
begin
RegisterComponents('ActiveX', [TButtonEdit]);
end;end.
ps:兄弟,如果上面的代码是你写的话,那你的风格真成问题。-_-#