{要做的按钮:
1.可以设置背景颜色(使用panel的color)
2.caption属性可换行(在panel上加个label实现label的caption换行)
3.可加载图片(在panel上加个speedbutton,speedbutton上可以加载图片)
请问我要继承什么哪个类Tcomponent吗?然后我自己还会添加一些属性,代码如下:}unit btnHotKey;interfaceuses
SysUtils, Classes;type
TbtnHotKey = class(TComponent)
private
m_PhoneState : SmallInt;
function GetPhoneState : SmallInt;
procedure SetPhoneState(state : SmallInt); m_DeptPhone : string;
function GetDeptPhone : string;
procedure SetDeptPhone(phone : string);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
property PhoneState : SmallInt read GetPhoneState write SetPhoneState;
property DeptPhone : String read GetDeptPhone write SetDeptPhone;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Standard', [TbtnHotKey]);
end;function TbtnHotKey.GetPhoneState: SmallInt;
begin
result := GetPhoneState;
end;
procedure TbtnHotKey.SetPhoneState(state : SmallInt);
begin
m_PhoneState :=state;
end;function TbtnHotKey.GetDeptPhone : string;
begin
result:=trim(m_DeptPhone);
end;
procedure TbtnHotKey.SetDeptPhone(phone : string);
begin
m_DeptPhone :=phone;
end;end.
1.可以设置背景颜色(使用panel的color)
2.caption属性可换行(在panel上加个label实现label的caption换行)
3.可加载图片(在panel上加个speedbutton,speedbutton上可以加载图片)
请问我要继承什么哪个类Tcomponent吗?然后我自己还会添加一些属性,代码如下:}unit btnHotKey;interfaceuses
SysUtils, Classes;type
TbtnHotKey = class(TComponent)
private
m_PhoneState : SmallInt;
function GetPhoneState : SmallInt;
procedure SetPhoneState(state : SmallInt); m_DeptPhone : string;
function GetDeptPhone : string;
procedure SetDeptPhone(phone : string);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
property PhoneState : SmallInt read GetPhoneState write SetPhoneState;
property DeptPhone : String read GetDeptPhone write SetDeptPhone;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Standard', [TbtnHotKey]);
end;function TbtnHotKey.GetPhoneState: SmallInt;
begin
result := GetPhoneState;
end;
procedure TbtnHotKey.SetPhoneState(state : SmallInt);
begin
m_PhoneState :=state;
end;function TbtnHotKey.GetDeptPhone : string;
begin
result:=trim(m_DeptPhone);
end;
procedure TbtnHotKey.SetDeptPhone(phone : string);
begin
m_DeptPhone :=phone;
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货