?? aactrls.pas
字號(hào):
{*******************************************************************************
AAFont - 平滑特效字體控件包
---------------------------
(C)Copyright 2001-2003
與月共舞工作室 周勁羽
這一控件包是自由軟件,您可以遵照自由軟件基金會(huì)出版的GNU 較
寬松通用公共許可證協(xié)議來修改和重新發(fā)布這一程序,或者用許可證的
第二版,或者(根據(jù)您的選擇)用任何更新的版本。
發(fā)布這一控件包的目的是希望它有用,但沒有任何擔(dān)保。甚至沒有
適合特定目的而隱含的擔(dān)保。更詳細(xì)的情況請(qǐng)參閱 GNU 較寬松通用公
共許可證。
您應(yīng)該已經(jīng)和控件包一起收到一份 GNU 較寬松通用公共許可證的
副本。如果還沒有,寫信給:
Free Software Foundation, Inc., 59 Temple Place - Suite
330, Boston, MA 02111-1307, USA.
原始文件名:AACtrls.pas
單元作者:周勁羽
下載地址:http://www.yygw.net
電子郵件:yygw@yygw.net
最后更新:2003.11.21
*******************************************************************************}
unit AACtrls;
{* |<PRE>
================================================================================
* 軟件名稱:平滑特效字體控件包
* 單元名稱:平滑特效字體控件單元
* 單元作者:與月共舞工作室 周勁羽
* 下載網(wǎng)址:http://www.yygw.net
* Eamil :yygw@yygw.net
* 開發(fā)平臺(tái):PWin2000Pro + Delphi 5.01
* 兼容測(cè)試:PWin9X/2000/XP + Delphi 5/6/7 + C++Build 5/6
* 備 注:該單元實(shí)現(xiàn)了以下幾個(gè)控件:
* 平滑特效字體標(biāo)簽 TAALabel
* 平滑特效超鏈接標(biāo)簽 TAALinkLabel
* 平滑特效文本控件 TAAText
* 平滑滾動(dòng)文本控件 TAAScrollText
* 平滑特效漸隱文本控件 TAAFadeText
* 最后更新:2003.11.21
================================================================================
|</PRE>}
interface
{$I AAFont.inc}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AAFont, ExtCtrls, StdCtrls, ShellAPI;
const
//版本號(hào)
verAAFont = 'V2.59';
type
{ TAAFontEffect }
TAAFontEffect = class(TCustomParam)
{* 平滑特效字體標(biāo)簽控件參數(shù)類}
published
property Transparent;
{* 控件是否透明}
property Layout;
{* 文本垂直方向?qū)R方式}
property Alignment;
{* 文本水平對(duì)齊方式}
property Quality;
{* 平滑字體顯示精度}
property FontEffect;
{* 平滑特效字體屬性}
property BackColor;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode;
{* 控件背景圖像顯示模式}
end;
{ TAALabel }
TAALabel = class(TAAGraphicControl)
{* 平滑特效字體標(biāo)簽控件,用于顯示單行文本,在控件的Effect屬性中定義了所有與
特效顯示相關(guān)的設(shè)置。
|<BR> 注:該控件不支持多行文本,如果需要顯示多行文本,用TAAText來代替。
|<BR> 在設(shè)計(jì)期,可通過雙擊控件來快速設(shè)置字體特效屬性}
private
{ Private declarations }
FEffect: TAAFontEffect;
MemBmp: TBitmap;
procedure SetEffect(const Value: TAAFontEffect);
protected
{ Protected declarations }
procedure PaintCanvas; override;
procedure Reset; override;
procedure TransparentPaint;
procedure DrawMem;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
published
{ Published declarations }
property AutoSize;
{* 是否自動(dòng)設(shè)置控件尺寸}
property Border;
{* 控件邊界保留寬度}
property Caption;
{* 控件標(biāo)題}
property Font;
{* 字體}
property Width default 46;
{* 控件寬度}
property Height default 12;
{* 控件高度}
property Effect: TAAFontEffect read FEffect write SetEffect;
{* 平滑特效字體屬性}
end;
{ THotLink }
THotLink = class(TCustomParam)
{* 平滑特效字體超鏈接標(biāo)簽控件超鏈接參數(shù)類}
private
FFade: Boolean;
FUnderLine: Boolean;
FFadeDelay: Cardinal;
FURL: string;
FFontEffect: TAAEffect;
FColor: TColor;
FBackColor: TColor;
procedure SetFontEffect(const Value: TAAEffect);
public
constructor Create; reintroduce;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
procedure Assign(Source: TPersistent); override;
{* 對(duì)象賦值方法}
published
property Fade: Boolean read FFade write FFade default True;
{* 是否允許淡入淡出顯示}
property FadeDelay: Cardinal read FFadeDelay write FFadeDelay
default 600;
{* 淡入淡出顯示延時(shí)}
property Color: TColor read FColor write FColor default clBlue;
{* 高亮?xí)r的高亮?xí)r的字體顏色}
property BackColor: TColor read FBackColor write FBackColor default clBtnface;
{* 高亮?xí)r的背景顏色}
property FontEffect: TAAEffect read FFontEffect write SetFontEffect;
{* 高亮?xí)r的字體特效參數(shù)}
property URL: string read FURL write FURL;
{* 超鏈接內(nèi)容或文件名,例如:
|<PRE>
http://www.yygw.net - 網(wǎng)頁
mailto:yygw@yygw.net - 郵件地址
mailto:yygw@yygw.net?subject=你好 - 帶郵件標(biāo)題的郵件地址鏈接
c:\tools\anyexe.exe - 可執(zhí)行文件
d:\aafont\readme.txt - 文本文件等其它文件
其它有效的超鏈接地址或文件名,相當(dāng)于“開始”菜單中的“運(yùn)行”命令
|</PRE>}
property UnderLine: Boolean read FUnderLine write FUnderLine
default False;
{* 高亮?xí)r是否顯示下劃線}
property Transparent;
{* 高亮?xí)r的透明設(shè)置}
property BackGround;
{* 高亮?xí)r的背景圖像}
property BackGroundMode;
{* 高亮?xí)r的背景圖像顯示模式}
end;
{ TAALinkLabel }
TFadeStyle = (fsNone, fsIn, fsOut);
TAALinkLabel = class(TAALabel)
{* 平滑特效超鏈接標(biāo)簽控件,用于顯示超鏈接,支持切換時(shí)的淡入淡出效果}
private
{ Private declarations }
HotBmp: TBitmap;
BlendBmp: TBitmap;
FadeTimer: TTimer;
FFadeStyle: TFadeStyle;
FProgress: TProgress;
FHotLink: THotLink;
FMouseIn: Boolean;
NewProg: Double;
procedure OnFadeTimer(Sender: TObject);
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure SetProgress(const Value: TProgress);
procedure SetFadeStyle(const Value: TFadeStyle);
procedure SetHotLink(const Value: THotLink);
protected
{ Protected declarations }
property Progress: TProgress read FProgress write SetProgress;
property FadeStyle: TFadeStyle read FFadeStyle write SetFadeStyle;
procedure DrawHot;
procedure PaintCanvas; override;
procedure SetEnabled(Value: Boolean); override;
procedure LoadedEx; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
procedure Click; override;
{* 模擬用戶點(diǎn)擊該控件,調(diào)用HotLink的URL屬性}
published
{ Published declarations }
property HotLink: THotLink read FHotLink write SetHotLink;
{* 超鏈接屬性}
end;
{ TTextParam }
TTextParam = class(TCustomTextParam)
{* 平滑特效文本控件參數(shù)類}
protected
function IsLinesStored: Boolean; override;
public
constructor Create(AOwner: TAAGraphicControl; ChangedProc:
TNotifyEvent); override;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
published
property WordWrap;
{* 是否允許自動(dòng)換行}
property RowPitch;
{* 文本行間距,單位為字體高度的百分比}
property Lines;
{* 文本內(nèi)容屬性,允許使用字體標(biāo)簽和用戶標(biāo)簽來控制每一行文本的對(duì)齊方式和字體特效。
使用標(biāo)簽時(shí)用一對(duì)尖括號(hào)'<'、'>'將標(biāo)簽名引起來,控制標(biāo)簽的作用范圍由LabelEffect
決定。另見文本控件的Fonts、Labels屬性。}
property Transparent;
{* 是否允許控件透明}
property Alignment;
{* 默認(rèn)的文本對(duì)齊方式,如果文本內(nèi)有對(duì)齊標(biāo)簽,則由對(duì)齊標(biāo)簽決定。
|<BR> 另見LabelEffect、Lines、Labels屬性}
property Quality;
{* 平滑字顯示精度}
property FontEffect;
{* 默認(rèn)的字體特效參數(shù),如果文本內(nèi)有字體標(biāo)簽,則由字體標(biāo)簽決定。
|<BR> 另見LabelEffect、Lines、Fonts、Font屬性}
property LabelEffect;
{* 字體、對(duì)齊標(biāo)簽作用范圍}
property BackColor;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode;
{* 控件背景顯示模式}
end;
{ TAAText }
TAAText = class(TAACustomText)
{* 平滑特效文本控件,用于顯示多行文本,通過使用標(biāo)簽,允許每行文本使用不同的
對(duì)齊方式和字體特效。}
private
{ Private declarations }
FText: TTextParam;
procedure SetText(const Value: TTextParam);
protected
{ Protected declarations }
TextBmp: TBitmap;
procedure PaintCanvas; override;
procedure LoadedEx; override;
function UseDefaultLabels: Boolean; override;
procedure CalcSize;
procedure DrawCanvas(ACanvas: TCanvas);
procedure CreateText;
procedure TransparentPaint;
procedure Reset; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
published
{ Published declarations }
property AutoSize;
{* 是否自動(dòng)設(shè)置控件尺寸}
property Border;
{* 控件邊界保留寬度}
property Font;
{* 控件字體}
property Width default 46;
{* 控件寬度}
property Height default 12;
{* 控件高度}
property Text: TTextParam read FText write SetText;
{* 控件文本內(nèi)容及顯示參數(shù)}
end;
TAAScrollText = class;
{ TScrollTextParam }
TScrollTextParam = class(TCustomTextParam)
{* 平滑滾動(dòng)文本控件參數(shù)類}
private
FFade: Boolean;
FFadeHeight: Integer;
FTailSpace: Integer;
FHeadSpace: Integer;
procedure SetFade(const Value: Boolean);
procedure SetFadeHeight(const Value: Integer);
procedure SetTailSpace(const Value: Integer);
procedure SetHeadSpace(const Value: Integer);
protected
function IsLinesStored: Boolean; override;
public
constructor Create(AOwner: TAAGraphicControl; ChangedProc:
{* 類構(gòu)造器}
TNotifyEvent); override;
destructor Destroy; override;
{* 類析構(gòu)器}
published
property Fade: Boolean read FFade write SetFade default True;
{* 是否允許控件上下邊界淡入淡出}
property FadeHeight: Integer read FFadeHeight write SetFadeHeight default 10;
{* 淡入淡出邊界的高度}
property HeadSpace: Integer read FHeadSpace write SetHeadSpace default 0;
{* 滾動(dòng)內(nèi)容頭部空白高度,單位為控件高度的百分比}
property TailSpace: Integer read FTailSpace write SetTailSpace default 60;
{* 滾動(dòng)內(nèi)容尾部空白高度,單位為控件高度的百分比}
property Alignment default taCenter;
{* 默認(rèn)的文本對(duì)齊方式,如果文本內(nèi)有對(duì)齊標(biāo)簽,則由對(duì)齊標(biāo)簽決定。
|<BR> 另見LabelEffect、Lines、Labels屬性}
property RowPitch;
{* 文本行間距,單位為字體高度的百分比}
property WordWrap;
{* 是否允許自動(dòng)換行}
property Lines;
{* 文本內(nèi)容屬性,允許使用字體標(biāo)簽和用戶標(biāo)簽來控制每一行文本的對(duì)齊方式和字體特效。
使用標(biāo)簽時(shí)用一對(duì)尖括號(hào)'<'、'>'將標(biāo)簽名引起來,控制標(biāo)簽的作用范圍由LabelEffect
決定。另見文本控件的Fonts、Labels屬性。}
property Quality;
{* 平滑字顯示精度}
property FontEffect;
{* 默認(rèn)的字體特效參數(shù),如果文本內(nèi)有字體標(biāo)簽,則由字體標(biāo)簽決定。
|<BR> 另見LabelEffect、Lines、Fonts、Font屬性}
property LabelEffect;
{* 字體、對(duì)齊標(biāo)簽作用范圍}
property Font;
{* 默認(rèn)的字體參數(shù),如果文本內(nèi)有字體標(biāo)簽,則由字體標(biāo)簽決定。
|<BR> 另見LabelEffect、Lines、Fonts屬性}
property BackColor default clWhite;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode default bmTiled;
{* 控件背景顯示模式}
end;
{ TAAScrollText }
TAAScrollText = class(TAACustomText)
{* 平滑滾動(dòng)文本控件,用于多行文本的動(dòng)態(tài)滾動(dòng)顯示}
private
{ Private declarations }
FScrollDelay: Word;
FScrollStep: Integer;
FRepeatDelay: Word;
FRepeatCount: TBorderWidth;
FRepeatedCount: Integer;
FText: TScrollTextParam;
FCurrPos: Integer;
TextBmp: TBitmap;
CurrBmp: TBitmap;
DelayTimer: TTimer;
ScrollTimer: TTimerEx;
FActive: Boolean;
procedure CreateText;
procedure OnDelayTimer(Sender: TObject);
procedure OnScrollTimer(Sender: TObject);
procedure SetActive(const Value: Boolean);
procedure SetScrollDelay(const Value: Word);
procedure SetScrollStep(const Value: Integer);
procedure SetRepeatDelay(const Value: Word);
procedure SetRepeatCount(const Value: TBorderWidth);
procedure SetText(const Value: TScrollTextParam);
procedure SetCurrPos(const Value: Integer);
function GetScrollQuality: TTimerQuality;
procedure SetScrollQuality(const Value: TTimerQuality);
function GetBmpHeight: Integer;
protected
{ Protected declarations }
procedure CreateDefFonts; override;
procedure PaintCanvas; override;
function UseDefaultLabels: Boolean; override;
procedure LoadedEx; override;
function CanResize(var NewWidth, NewHeight: Integer): Boolean; override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
{* 類構(gòu)造器}
destructor Destroy; override;
{* 類析構(gòu)器}
procedure Reset; override;
{* 重新創(chuàng)建滾動(dòng)內(nèi)容,用于AutoUpdate為假時(shí),在運(yùn)行期動(dòng)態(tài)修改控件參數(shù)后初始化控件滾動(dòng)。}
procedure ReStart;
{* 重新開始滾動(dòng),清滾動(dòng)計(jì)數(shù)器,文本從頭開始滾動(dòng)}
property RepeatedCount: Integer read FRepeatedCount;
{* 已循環(huán)滾動(dòng)次數(shù),運(yùn)行期只讀屬性}
property CurrPos: Integer read FCurrPos write SetCurrPos;
{* 當(dāng)前顯示的內(nèi)容在整個(gè)圖像中的位置,用戶可用它來手動(dòng)控制控件滾動(dòng)}
property BmpHeight: Integer read GetBmpHeight;
{* 整個(gè)圖象的高度}
published
{ Published declarations }
property AutoUpdate;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -