?? aactrls.pas
字號:
{*******************************************************************************
AAFont - 平滑特效字體控件包
---------------------------
(C)Copyright 2001-2004
CnPack 開發組 周勁羽
這一控件包是自由軟件,您可以遵照自由軟件基金會出版的GNU 較
寬松通用公共許可證協議來修改和重新發布這一程序,或者用許可證的
第二版,或者(根據您的選擇)用任何更新的版本。
發布這一控件包的目的是希望它有用,但沒有任何擔保。甚至沒有
適合特定目的而隱含的擔保。更詳細的情況請參閱 GNU 較寬松通用公
共許可證。
您應該已經和控件包一起收到一份 GNU 較寬松通用公共許可證的
副本。如果還沒有,寫信給:
Free Software Foundation, Inc., 59 Temple Place - Suite
330, Boston, MA 02111-1307, USA.
單元作者:CnPack 開發組 周勁羽
下載地址:http://www.cnvcl.org
電子郵件:zjy@cnvcl.org
*******************************************************************************}
unit AACtrls;
{* |<PRE>
================================================================================
* 軟件名稱:平滑特效字體控件包
* 單元名稱:平滑特效字體控件單元
* 單元作者:CnPack 開發組 周勁羽
* 下載網址:http://www.cnvcl.org
* Eamil :zjy@cnvcl.org
* 開發平臺:PWin2000Pro + Delphi 5.01
* 兼容測試:PWin9X/2000/XP + Delphi 5/6/7/2005 + C++Build 5/6
* 備 注:該單元實現了以下幾個控件:
* 平滑特效字體標簽 TAALabel
* 平滑特效超鏈接標簽 TAALinkLabel
* 平滑特效文本控件 TAAText
* 平滑滾動文本控件 TAAScrollText
* 平滑特效漸隱文本控件 TAAFadeText
* 最后更新:2004.11.29
================================================================================
|</PRE>}
interface
{$I AAFont.inc}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AAFont, AATimer, ExtCtrls, StdCtrls, ShellAPI;
const
//版本號
verAAFont = 'V2.63';
type
{ TAAFontEffect }
TAAFontEffect = class(TCustomParam)
{* 平滑特效字體標簽控件參數類}
published
property Transparent;
{* 控件是否透明}
property Layout;
{* 文本垂直方向對齊方式}
property Alignment;
{* 文本水平對齊方式}
property Quality;
{* 平滑字體顯示精度}
property FontEffect;
{* 平滑特效字體屬性}
property BackColor;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode;
{* 控件背景圖像顯示模式}
end;
{ TAALabel }
TAALabel = class(TAAGraphicControl)
{* 平滑特效字體標簽控件,用于顯示單行文本,在控件的Effect屬性中定義了所有與
特效顯示相關的設置。
|<BR> 注:該控件不支持多行文本,如果需要顯示多行文本,用TAAText來代替。
|<BR> 在設計期,可通過雙擊控件來快速設置字體特效屬性}
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;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
published
{ Published declarations }
property AutoSize;
{* 是否自動設置控件尺寸}
property Border;
{* 控件邊界保留寬度}
property Caption;
{* 控件標題}
property Font;
{* 字體}
property Width default 46;
{* 控件寬度}
property Height default 12;
{* 控件高度}
property Effect: TAAFontEffect read FEffect write SetEffect;
{* 平滑特效字體屬性}
end;
{ THotLink }
THotLink = class(TCustomParam)
{* 平滑特效字體超鏈接標簽控件超鏈接參數類}
private
FFade: Boolean;
FUnderLine: Boolean;
FFadeDelay: Cardinal;
FURL: string;
FFontEffect: TAAEffect;
FColor: TColor;
FBackColor: TColor;
procedure SetFontEffect(const Value: TAAEffect);
public
constructor Create; reintroduce;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
procedure Assign(Source: TPersistent); override;
{* 對象賦值方法}
published
property Fade: Boolean read FFade write FFade default True;
{* 是否允許淡入淡出顯示}
property FadeDelay: Cardinal read FFadeDelay write FFadeDelay
default 600;
{* 淡入淡出顯示延時}
property Color: TColor read FColor write FColor default clBlue;
{* 高亮時的高亮時的字體顏色}
property BackColor: TColor read FBackColor write FBackColor default clBtnface;
{* 高亮時的背景顏色}
property FontEffect: TAAEffect read FFontEffect write SetFontEffect;
{* 高亮時的字體特效參數}
property URL: string read FURL write FURL;
{* 超鏈接內容或文件名,例如:
|<PRE>
http://www.cnvcl.org - 網頁
mailto:zjy@cnvcl.org - 郵件地址
mailto:zjy@cnvcl.org?subject=你好 - 帶郵件標題的郵件地址鏈接
c:\tools\anyexe.exe - 可執行文件
d:\aafont\readme.txt - 文本文件等其它文件
其它有效的超鏈接地址或文件名,相當于“開始”菜單中的“運行”命令
|</PRE>}
property UnderLine: Boolean read FUnderLine write FUnderLine
default False;
{* 高亮時是否顯示下劃線}
property Transparent;
{* 高亮時的透明設置}
property BackGround;
{* 高亮時的背景圖像}
property BackGroundMode;
{* 高亮時的背景圖像顯示模式}
end;
{ TAALinkLabel }
TFadeStyle = (fsNone, fsIn, fsOut);
TAALinkLabel = class(TAALabel)
{* 平滑特效超鏈接標簽控件,用于顯示超鏈接,支持切換時的淡入淡出效果}
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;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
procedure Click; override;
{* 模擬用戶點擊該控件,調用HotLink的URL屬性}
published
{ Published declarations }
property HotLink: THotLink read FHotLink write SetHotLink;
{* 超鏈接屬性}
end;
{ TTextParam }
TTextParam = class(TCustomTextParam)
{* 平滑特效文本控件參數類}
protected
function IsLinesStored: Boolean; override;
public
constructor Create(AOwner: TAAGraphicControl; ChangedProc:
TNotifyEvent); override;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
published
property WordWrap;
{* 是否允許自動換行}
property RowPitch;
{* 文本行間距,單位為字體高度的百分比}
property Lines;
{* 文本內容屬性,允許使用字體標簽和用戶標簽來控制每一行文本的對齊方式和字體特效。
使用標簽時用一對尖括號'<'、'>'將標簽名引起來,控制標簽的作用范圍由LabelEffect
決定。另見文本控件的Fonts、Labels屬性。}
property Transparent;
{* 是否允許控件透明}
property Alignment;
{* 默認的文本對齊方式,如果文本內有對齊標簽,則由對齊標簽決定。
|<BR> 另見LabelEffect、Lines、Labels屬性}
property Quality;
{* 平滑字顯示精度}
property FontEffect;
{* 默認的字體特效參數,如果文本內有字體標簽,則由字體標簽決定。
|<BR> 另見LabelEffect、Lines、Fonts、Font屬性}
property LabelEffect;
{* 字體、對齊標簽作用范圍}
property BackColor;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode;
{* 控件背景顯示模式}
end;
{ TAAText }
TAAText = class(TAACustomText)
{* 平滑特效文本控件,用于顯示多行文本,通過使用標簽,允許每行文本使用不同的
對齊方式和字體特效。}
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;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
published
{ Published declarations }
property AutoSize;
{* 是否自動設置控件尺寸}
property Border;
{* 控件邊界保留寬度}
property Font;
{* 控件字體}
property Width default 46;
{* 控件寬度}
property Height default 12;
{* 控件高度}
property Text: TTextParam read FText write SetText;
{* 控件文本內容及顯示參數}
end;
TAAScrollText = class;
{ TScrollTextParam }
TScrollTextParam = class(TCustomTextParam)
{* 平滑滾動文本控件參數類}
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:
{* 類構造器}
TNotifyEvent); override;
destructor Destroy; override;
{* 類析構器}
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;
{* 滾動內容頭部空白高度,單位為控件高度的百分比}
property TailSpace: Integer read FTailSpace write SetTailSpace default 60;
{* 滾動內容尾部空白高度,單位為控件高度的百分比}
property Alignment default taCenter;
{* 默認的文本對齊方式,如果文本內有對齊標簽,則由對齊標簽決定。
|<BR> 另見LabelEffect、Lines、Labels屬性}
property RowPitch;
{* 文本行間距,單位為字體高度的百分比}
property WordWrap;
{* 是否允許自動換行}
property Lines;
{* 文本內容屬性,允許使用字體標簽和用戶標簽來控制每一行文本的對齊方式和字體特效。
使用標簽時用一對尖括號'<'、'>'將標簽名引起來,控制標簽的作用范圍由LabelEffect
決定。另見文本控件的Fonts、Labels屬性。}
property Quality;
{* 平滑字顯示精度}
property FontEffect;
{* 默認的字體特效參數,如果文本內有字體標簽,則由字體標簽決定。
|<BR> 另見LabelEffect、Lines、Fonts、Font屬性}
property LabelEffect;
{* 字體、對齊標簽作用范圍}
property Font;
{* 默認的字體參數,如果文本內有字體標簽,則由字體標簽決定。
|<BR> 另見LabelEffect、Lines、Fonts屬性}
property BackColor default clWhite;
{* 控件背景顏色}
property BackGround;
{* 控件背景圖像}
property BackGroundMode default bmTiled;
{* 控件背景顯示模式}
end;
{ TAAScrollText }
TAAScrollText = class(TAACustomText)
{* 平滑滾動文本控件,用于多行文本的動態滾動顯示}
private
{ Private declarations }
FScrollDelay: Word;
FScrollStep: Integer;
FRepeatDelay: Word;
FRepeatCount: TBorderWidth;
FRepeatedCount: Integer;
FText: TScrollTextParam;
FCurrPos: Integer;
TextBmp: TBitmap;
CurrBmp: TBitmap;
DelayTimer: TTimer;
ScrollTimer: TAATimer;
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 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;
{* 類構造器}
destructor Destroy; override;
{* 類析構器}
procedure Reset; override;
{* 重新創建滾動內容,用于AutoUpdate為假時,在運行期動態修改控件參數后初始化控件滾動。}
procedure ReStart;
{* 重新開始滾動,清滾動計數器,文本從頭開始滾動}
property RepeatedCount: Integer read FRepeatedCount;
{* 已循環滾動次數,運行期只讀屬性}
property CurrPos: Integer read FCurrPos write SetCurrPos;
{* 當前顯示的內容在整個圖像中的位置,用戶可用它來手動控制控件滾動}
property BmpHeight: Integer read GetBmpHeight;
{* 整個圖象的高度}
published
{ Published declarations }
property AutoUpdate;
{* 是否允許控件參數變更時自動重新創建滾動內容。如果有很多參數需要在運行時設置,
可將該屬性設為False,待設定完參數后調用Reset方法。}
property Active: Boolean read FActive write SetActive default True;
{* 是否允許文本滾動}
property Height default 280;
{* 控件高度}
property Width default 240;
{* 控件寬度}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -