紧急!实现控件的About框显示(100分)

  • 主题发起人 主题发起人 webzsm
  • 开始时间 开始时间
W

webzsm

Unregistered / Unconfirmed
GUEST, unregistred user!
本人想实现在控件中增加一个ABOUT属性,设计时,点击ABOUT可以弹出提示框。就像
COOLCONTROL的ABOUT属性似的。但屡试不成,请高手帮助给个样例
 
看看其他控件的源码就行了吧?
 
我看过coolcontrol的,但照样子去试,只是出现 about:[ttestabout],
点击没有任何放应(而我其实实现了ttestabout.edit函数(在其中弹出窗口))
 
//Delphi5
unit NewTest;

interface

uses
Windows, Messages, SysUtils, Classes, Controls, Dialogs, Forms,
dsgnintf;

type
TP = type string;

TAboutProperty = class(TPropertyEditor)
public
procedure Edit;override;
function GetAttributes:TpropertyAttributes;override;
function GetValue:String;override;
end;

TNewTest = class(TControl)
private
FAbout: TP;
{ Private declarations }
protected
{ Protected declarations }
public
constructor Create(AOwner: TComponent);override;
procedure Loaded;override;

{ Public declarations }
published
property About: TP read FAbout write FAbout;
{ Published declarations }
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Test', [TNewTest]);
RegisterpropertyEditor(TypeInfo(TP),TNewTest,'About',TAboutproperty);
end;

{ TNewTest }

constructor TNewTest.Create(AOwner: TComponent);
begin
inherited;

end;

procedure TNewTest.Loaded;
begin
inherited;
end;



{ TAboutProperty }

procedure TAboutProperty.Edit;
begin
inherited;
Application.MessageBox('NeTest Version 1.0'+#13+#13+
'This is afreeware component.',
'NeTest 1.0',
MB_OK+MB_ICONINFORMATION);
end;

function TAboutProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paMultiSelect,paDialog,paReadOnly];
end;

function TAboutProperty.GetValue: String;
begin
Result := 'About';
end;


end.
 
你是否调用了RegisterPropertyEditor
RegisterPropertyEditor的例子:
RegisterPropertyEditor(TypeInfo(TComponentName), TComponent, 'Name', TComponentNameProperty);
 
调用了RegisterPropertyEditor,但是如j5203的做法,仍然弹不出信息。
 
j5203的
TP = type string;
声明可能不适合
 
谢谢,问题已经解决
 
后退
顶部