• 网络学院
  • 新手学堂
  • 操作系统
  • 网络技术
  • 软件应用
  • 办公软件
  • 编程技术
  • 网站架设
  • 数据库类
  • 平面设计
  • 多媒体类
  • 游戏资讯
  • 教学论文
  • 认证考试
Delphi控件,我们也可以(4)
广告位
  站点:
  • 首 页
  • 最新软件
  • 最新文章
  • 国内软件
  • 国外软件
  • 汉化软件
  • 源码下载
  • 字体下载
Delphi控件,我们也可以(4)
软件发布 Delphi控件,我们也可以(4)
网络软件 系统工具 应用软件 联络聊天 图形图像 多媒体类 行业软件 游戏娱乐 编程开发 安全相关 教育教学 数码软件
热门软件: QQ 瑞星 pplive e话通 木马克星 千千静听 office2000 五笔字根 Photoshop 视频分割
返回首页 | 文章首页 | 编程技术 | Delphi教程 | Delphi控件,我们也可以(4)

Delphi控件,我们也可以(4)

 

添加时间: 2006-2-28 8:29:39  作者: Delphi教程  阅读次数:173   来源: http://www.d9soft.com

 

 

        下面是我的代码:

unit LxTouchLabel;

interface

uses

Windows, Messages, SysUtils, Classes, Controls, StdCtrls, Graphics;

type

TTouchLabel = class(TLabel)

private

{ Private declarations }

FColor : TColor;

FTouchColor : TColor;

FTempColor : TColor;

FTouchFont : TFont;

FTempFont : TFont;

isStoreTouchFont : Boolean;

function GetTouchBKColor : TColor;

function isStoreTouchBKColor : Boolean;

procedure SetTouchBKColor(AColor : TColor);

procedure SetTouchFont(AFont : TFont);

procedure CMMouseEnter(var Message : TMessage); Message CM_MOUSEENTER;

procedure CMMouseLeave(var Message : TMessage); Message CM_MOUSELEAVE;

protected

{ Protected declarations }

public

{ Public declarations }

constructor Create(AOwner: TComponent); override;

destructor Destroy; override;

published

{ Published declarations }

property Color;

property ParentColor;

property ParentFont;

property TouchBKColor : TColor Read GetTouchBKColor Write SetTouchBKColor

stored isStoreTouchBKColor default clWindow;

property TouchFont : TFont Read FTouchFont Write SetTouchFont

stored isStoreTouchFont;

property ChangeWhileTouch : Boolean Read isStoreTouchFont

Write isStoreTouchFont default True;

end;


procedure Register;

implementation

procedure Register;

begin

RegisterComponents('LX', [TTouchLabel]);

end;

{ TTouchLabel }

constructor TTouchLabel.Create(AOwner: TComponent);

begin

inherited;

FTempColor := clWindow;

FTempFont := TFont.Create;

FTouchFont := TFont.Create;

isStoreTouchFont := True;

end;


destructor TTouchLabel.Destroy;

begin

FTempFont.Free;

FTouchFont.Free;

inherited;

end;



function TTouchLabel.GetTouchBKColor: TColor;

begin

Result := FTouchColor;

end;


procedure TTouchLabel.SetTouchFont(AFont: TFont);

begin

FTouchFont.Assign(AFont);

isStoreTouchFont := True;

end;


procedure TTouchLabel.CMMouseEnter(var Message: TMessage);

begin

inherited;

if not ChangeWhileTouch then exit;

if FColor <> FTouchColor then

begin

FTempColor := Color;

Color := TouchBKColor;

end;


FTempFont.Assign(Font);

Font.Assign(TouchFont);

end;


procedure TTouchLabel.CMMouseLeave(var Message: TMessage);

begin

inherited;

if not ChangeWhileTouch then exit;

if FColor <> FTouchColor then

Color := FTempColor;

Font.Assign(FTempFont);

end;


procedure TTouchLabel.SetTouchBKColor(AColor: TColor);

begin

FTouchColor := AColor;

end;


function TTouchLabel.isStoreTouchBKColor: Boolean;

begin

Result := (FColor <> FTouchColor);

end;

end.


///////////////////////////////////////////////////////////////////////

unit QLXTouchLable;

interface

uses

Windows, Messages, SysUtils, Classes, QControls, QStdCtrls, QGraphics;

type

TTouchLable = class(TLabel)

private

{ Private declarations }

FColor : TColor;

FTouchColor : TColor;

FTempColor : TColor;

FTouchFont : TFont;

FTempFont : TFont;

isStoreTouchFont : Boolean;

function GetTouchColor : TColor;

function isStoreTouchColor : Boolean;

procedure SetTouchColor(AColor : TColor);

procedure SetTouchFont(AFont : TFont);

procedure MouseEnter(AControl: TControl); override;

procedure MouseLeave(AControl: TControl); override;

protected

{ Protected declarations }

public

{ Public declarations }

constructor Create(AOwner: TComponent); override;

destructor Destroy; override;

published

{ Published declarations }

property Color;

property ParentColor;

property ParentFont;

property TouchColor : TColor Read GetTouchColor Write SetTouchColor

stored isStoreTouchColor default clWindow;

property TouchFont : TFont Read FTouchFont Write SetTouchFont

stored isStoreTouchFont;

property ChangeWhileTouch : Boolean Read isStoreTouchFont

Write isStoreTouchFont default True;

end;


procedure Register;

implementation

procedure Register;

begin

RegisterComponents('LX', [TTouchLable]);

end;


{ TTouchLable }

constructor TTouchLable.Create(AOwner: TComponent);

begin

inherited;

FTempColor := clWindow;

FTempFont := TFont.Create;

FTouchFont := TFont.Create;

isStoreTouchFont := True;

end;


destructor TTouchLable.Destroy;

begin

FTempFont.Free;

FTouchFont.Free;

inherited;

end;


function TTouchLable.GetTouchColor: TColor;

begin

Result := FTouchColor;

end;


function TTouchLable.isStoreTouchColor: Boolean;

begin

Result := (FColor <> FTouchColor);

end;


procedure TTouchLable.MouseEnter(AControl: TControl);

begin

inherited;

if not ChangeWhileTouch then exit;

if FColor <> FTouchColor then

begin

FTempColor := Color;

Color := TouchColor;

end;


FTempFont.Assign(Font);

Font.Assign(TouchFont);

end;


procedure TTouchLable.MouseLeave(AControl: TControl);

begin

inherited;

if not ChangeWhileTouch then exit;

if FColor <> FTouchColor then

Color := FTempColor;

Font.Assign(FTempFont);

end;


procedure TTouchLable.SetTouchColor(AColor: TColor);

begin

FTouchColor := AColor;

end;


procedure TTouchLable.SetTouchFont(AFont: TFont);

begin

FTouchFont.Assign(AFont);

isStoreTouchFont := True;

end;

end.

 

 

 

上下文章:

 

上一篇文章: 用Delphi实现打印功能 下一篇文章: Delphi控件,我们也可以(3)

相关文章:

  • Windows网络安全我们只差五步
  • Delphi中的Access技巧集
  • 网管告诉我们的经验:用交换机做DHCP服务器
  • 六个版本的Vista,我们应该如何选择
  • GHOST!你也可以做到自己还原光蝶DIY

相关软件:

  • ShellBrowser For C++ & Delphi V5.14
  • 我们的歌(MP3下载软件) V1.30
  • InfoPower for Delphi 5 V2000.17
  • All AHM Triton Tools 2002 Borland Delphi V7.0
  • 佐尔表达式控件 For DELPHI 7.0 V3.1.12
  • Delphi Project Launcher V1.5

 

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • ASP源码
  • PHP源码
  • Net源码
  • JSP 源码

编程技术分类导航

  • ASP & ASP.NET教程
  • PHP教程
  • JSP教程
  • C/C++教程
  • VB & VB.NET教程
  • VC教程
  • Delphi教程
  • BCB教程
  • VFP教程
  • PB教程
  • JAVA教程
  • XML教程
  • C#教程
  • CGI教程

本类经典文章推荐

  • Delphi的两个实用技巧(1)播放Flash
  • Delphi的两个实用技巧(2)巧用Wind...
  • delphi实例编程之--制作可随处拖放...
  • 关于VisiBroker For Delphi的使用...
  • 关于VisiBroker For Delphi的使用...
  • 关于VisiBroker For Delphi的使用...
  • 在线播放器DIY
  • Delphi让你发送Flash电子邮件
  • 在窗口标题区添加按钮
  • 用Delphi 6编程实现自动标注汉语拼...

Delphi教程阅读排行

  • Delphi7从入门到精通之历数Delphi...
  • Delphi的两个实用技巧(1)播放Flash
  • Delphi7从入门到精通之认识Delphi...
  • delphi实例编程之--制作可随处拖放...
  • Delphi控件,我们也可以(1)
  • Delphi的两个实用技巧(2)巧用Wind...
  • 在线播放器DIY
  • Delphi控件,我们也可以(2)
  • 用Delphi + DirectX开发简单RPG游...
  • 用Delphi 6编程实现自动标注汉语拼...

编程技术阅读总排行

  • VB入门教程之一
  • 第二章 PowerBuilder 入门之创建新...
  • Java连接数据库实例
  • 第一章 什么是PowerBuilder
  • VC++之List Box/Check List Box控...
  • VC++ List Ctrl控件
  • VC++ Combo Box/Combo Box Ex控件
  • 学C++不得不看的一篇文章
  • VB入门教程之二
  • VC++之Button控件

广告位置

字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 回到顶部

关于我们 | 版权声明 | 免责条款 | 广告联系 | 软件发布 | 下载帮助 | 下载排行 | 网站地图 | 特别鸣谢 | 友情连接

copyright; 2005-2008 D9soft.com 第九软件网 版权所有