xiaoqiang123 、 Little2000 、 ls2008 、 ycdelphicsdn
你们在哪里啊?不要笑我,我没有一本书的
你们在哪里啊?不要笑我,我没有一本书的
解决方案 »
- Delphi7检测到错误类 EAccessViolation,错误信息:'Access violation at address 0047D5C7 in module
- IdCookieManager的使用语法
- 你们谁来看看,我这个sql语句哪里有问题
- 各位兄弟帮忙!我用adoconnection连接sql2000 为什么在别的机子上运行我的程序就报用户名sa登陆失败呢?
- 5.小弟初学,迷惑5,请高手帮助。
- 问题还未解决呢,请各位救救小弟弟吧!!!!
- 能不能用ShellExecute执行批处理文件?
- 求maxlength-1 长的子串的算法
- 求个能导入excel各版本的组件或方法. 大家用什么去兼容的?
- 大神有人脸位置检测的代码吗?要位置就行!!
- 我这段代码哪里错了!HELP
- 请教高手,怎样得到要连接的服务器的计算机名和ip,并且要知道该服务器上是否已安装了sql server 2000
begin
end;
组织良好。设计组件时,要考虑到可能会有其他程序员要基于你的组件派生出一个新的组件。
然后,你可以确定从那个类上继承下来;
一般说来,可以有5部分:
1) 确定一个祖先类。
2) 创建一个组件单元。
3) 在新组件中添加属性、方法和事件。
4) 测试该组件。
5) 在D e l p h i中注册该组件。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, stdctrls;type
TColorLabel = class(TCustomLabel)
private
{ Private declarations }
FEnterColor: TColor;
FLeaveColor: TColor;
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
Procedure CMMouseEnter(Var Message: TMessage); Message CM_MOUSEENTER;
Procedure CMMouseLeave(Var Message: TMessage); Message CM_MOUSELEAVE;
Procedure SetEnterColor(const Value: TColor);
Procedure SetLeaveColor(const Value: TColor);
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent);override;
published
{ Published declarations }
property Anchors;
property BiDiMode;
property Caption;
property AutoSize;
property Color;
property Enabled;
property ShowHint;
property Transparent;
property Visible;
property WordWrap;
property PopupMenu; Property EnterColor: TColor read FEnterColor write SetEnterColor;
Property LeaveColor: TColor read FLeaveColor write SetLeaveColor;
property Font; property OnClick;
property OnMouseDown;
property OnMouseUp;
property OnMouseMove;
property OnMouseEnter :TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave :TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Jiangsx', [TColorLabel]);
end;procedure TColorlabel.CMMouseEnter(Var Message: TMessage);
begin
if csDesigning in ComponentState then
begin
Font.Color:=clBlue;
exit;
end;
Font.Color:=FEnterColor;
if Assigned(FOnMouseEnter) then
begin
FOnMouseEnter(self);
exit;
end;
end;procedure TColorlabel.CMMouseLeave(Var Message: TMessage);
begin
Font.Color:=FLeaveColor;
if Assigned(FOnMouseEnter) then
begin
FOnMouseEnter(self);
exit;
end;
end;constructor TColorlabel.Create(AOwner: TComponent);
begin
inherited;
FEnterColor := clRed;
FLeaveColor := clBlue;
Font.Color:=FLeaveColor;
end;procedure TColorlabel.SetEnterColor(const Value: TColor);
begin
FEnterColor := Value;
Font.Color := FEnterColor;
end;procedure TColorlabel.SetLeaveColor(const Value: TColor);
begin
FLeaveColor := Value;
Font.Color := FLeaveColor;
end;end.