控件自定义属性的问题?急急!!!!

xswgxnn 2005-12-27 07:55:12
以下是我在Tstatusbar控件的基础上扩展的控件,在控件上加入一个关于的属性,编写代码后可以安装且不出现问题,问题是在窗体上添加此控件后编译,就会出现DesignIntf.dcu或,DesignEditors.dcu找不着,把这两个文件放到控件目录下,又会出现Proxies.dcu单元找不到,且查找整个硬盘都没有Proxies.dcu单元,请高手指点这是错在那里?

unit StatusBarText;

interface

uses
Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,ComCtrls,
StdCtrls,DesignIntf,DesignEditors;

type
//定义About属性的属性编辑器
TAbout = class(TPropertyEditor)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override;
end;

TStatusBarEx = class(TStatusBar)
private
{ Private declarations }
FAbout:TAbout;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
property About: TAbout read FAbout;
{ Published declarations }
end;

procedure Register;

implementation

//以下是TAbout中的成员函数的实现
procedure TAbout.Edit;
begin
messagebox(application.handle,pchar('这是一个可扩展的控件包'),'关于扩展编辑控件',mb_iconinformation);
end;

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

function TAbout.GetValue: string;
begin
Result := '(Version 1.0.0)';
end;

constructor TStatusBarEx.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{为了让TStatusBarEx控件能接受其它控件,必须
使ControlStyle属性(集合类型)包含csAcceptsControls元素}
ControlStyle:= ControlStyle + [csAcceptsControls];
end;

procedure Register;
begin
RegisterComponents('XswEdBar', [TStatusBarEx]);
//为About属性注册属性编辑器
RegisterPropertyEditor(typeInfo(TAbout), nil,'About', TAbout);
end;

end.
...全文
118 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
GARNETT2183 2005-12-28
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/4413/4413226.xml?temp=.2626306
我也遇到这样的问题,不知怎么解决...
Randomize 2005-12-28
  • 打赏
  • 举报
回复
http://www.delphibbs.com/delphibbs/dispq.asp?lid=2279413
Randomize 2005-12-28
  • 打赏
  • 举报
回复
broland就没给Proxies这个单元
两种办法
1。自己写一个Proxies.Pas
如下
unit Proxies;
interface
Function IsProxyClass(ComponentClass: TClass): Boolean;
implementation
Function IsProxyClass(ComponentClass: TClass): Boolean;
begin
Result := True;
end;
end.
2.用包编译
在Package的Request中加入DesignIDE.DCP就可以了

PS:用搜索引擎混分,BS自己

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧