扩展Delphi/C++Builder的StatusBar功能

本文提供了一种在Delphi6/7及c++Builder6/2007环境下扩展StatusBar控件的方法,通过修改使其能够承载更多类型的控件,如Edit框、进度条等。

Delphi6/7,c++ Builder6/2007下的StatusBar控件的功能有限,通过该扩展,可以在StatusBar上加入其他的控件,如:Edit框,进度条等。

该代码已经使用若干年,现在整理出来,方便有需要的人。

 

//----------------Start of StatusBarEx --------------------------

//文件名:StatusBarEx.pas
unit StatusBarEx;

interface

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

type
//定义TStatusBarEx控件
TStatusBarEx = class(TStatusBar)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
end;

procedure Register;

implementation

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

procedure Register;
begin
//将TStatusBarEx控件注册到Delphi /C++ Builder 控件板的TaosVCL页上
RegisterComponents('TaosVCL',[TStatusBarEx]);
end;

end.

//---------End of File---------------------

【安装方法】
1、将以上代码复制并另存为StatusBarEx.pas,可把此文件放到Delphi/C++ Builder安装目录下的Projects子目录下。
2、在Delphi/C++ Builder中打开lib/dclusr.dpk(.bpk),向其中加入StatusbarEx.pas,再编译、安装即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值