ksskinhints.pas
来自「小区水费管理系统源代码水费收费管理系统 水费收费管理系统」· PAS 代码 · 共 178 行
PAS
178 行
{==============================================================================
SkinEngine's Hints
Copyright (C) 2000-2002 by Evgeny Kryukov
All rights reserved
All conTeThements of this file and all other files included in this archive
are Copyright (C) 2002 Evgeny Kryukov. Use and/or distribution of
them requires acceptance of the License Agreement.
See License.txt for licence information
$Id: KsskinHints.pas,v 1.1.1.1 2002/08/05 12:12:13 Evgeny Exp $
===============================================================================}
unit KsSkinHints;
{$I se_define.inc}
{$T-,W-,X+,P+}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, se_controls, KsSkinVersion, KsSkinObjects, KsSkinSource,
KsSkinEngine;
type
{ TSeSkinHint }
TSeSkinHint = class(TSeCustomHint)
private
FSkinEngine: TSeSkinEngine;
FSkinHint: TSeSkinObject;
FSkinObject: string;
function GetVersion: TSeSkinVersion;
procedure SetVersion(const Value: TSeSkinVersion);
procedure SetSkinEngine(const Value: TSeSkinEngine);
procedure SetSkinObject(const Value: string);
protected
function UseSkin: boolean;
function GetHintBounds(Canvas: TCanvas; const AHint: string): TRect; override;
procedure PaintHint(Canvas: TCanvas; R: TRect; const AHint: string); override;
{ VCL protected }
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property SkinEngine: TSeSkinEngine read FSkinEngine write SetSkinEngine;
property SkinObject: string read FSkinObject write SetSkinObject;
property Version: TSeSkinVersion read GetVersion write SetVersion
stored false;
end;
implementation {===============================================================}
{ TSeSkinHint ===============================================================}
constructor TSeSkinHint.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FSkinObject := 'Hint';
end;
destructor TSeSkinHint.Destroy;
begin
if FSkinHint <> nil then FSkinHint.Free;
inherited Destroy;
end;
function TSeSkinHint.UseSkin: boolean;
begin
if (csDestroying in ComponentState) or (csLoading in ComponentState) then
Result := false
else
if (FSkinEngine <> nil) and (FSkinEngine.SkinSource <> nil) and
(not FSkinEngine.SkinSource.IsChanging) and
(FSkinEngine.SkinSource.Count > 0) and
(FSkinEngine.SkinSource.GetObjectByName(FSkinObject) <> nil) and
(FSkinHint <> nil)
then
Result := true
else
Result := false;
end;
{ Overrides }
function TSeSkinHint.GetHintBounds(Canvas: TCanvas; const AHint: string): TRect;
begin
Result := Rect(0, 0, 1000, 1000);
if FSkinHint <> nil then
Canvas.Font.Assign(FSkinHint.Font);
DrawText(Canvas, AHint, Result, DT_CALCRECT or DT_LEFT or DT_WORDBREAK or DT_NOPREFIX);
if FSkinHint <> nil then
begin
Inc(Result.Right, FSkinHint.MarginLeft + FSkinHint.MarginRight);
Inc(Result.Bottom, FSkinHint.MarginTop + FSkinHint.MarginBottom);
end
else
begin
Inc(Result.Right, 6);
Inc(Result.Bottom, 6);
end;
if Shadow.Enabled then
begin
Inc(Result.Right, Shadow.Size);
Inc(Result.Bottom, Shadow.Size);
end;
end;
procedure TSeSkinHint.PaintHint(Canvas: TCanvas; R: TRect; const AHint: string);
begin
if UseSkin then
begin
FSkinHint.BoundsRect := R;
FSkinHint.Text := AHint;
FSkinHint.Draw(Canvas);
end
else
inherited ;
end;
procedure TSeSkinHint.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = FSkinEngine) then
SkinEngine := nil;
end;
{ Properties }
function TSeSkinHint.GetVersion: TSeSkinVersion;
begin
Result := sSeSkinVersion;
end;
procedure TSeSkinHint.SetVersion(const Value: TSeSkinVersion);
begin
end;
procedure TSeSkinHint.SetSkinEngine(const Value: TSeSkinEngine);
begin
FSkinEngine := Value;
if (FSkinEngine <> nil) and (FSkinEngine.SkinSource <> nil) and
(not FSkinEngine.SkinSource.IsChanging) and
(FSkinEngine.SkinSource.Count > 0) then
begin
if FSkinHint <> nil then FSkinHint.Free;
FSkinHint := nil;
if FSkinEngine.SkinSource.GetObjectByName(FSkinObject) <> nil then
FSkinHint := FSkinEngine.SkinSource.GetObjectByName(FSkinObject).CreateCopy(nil);
end
else
begin
if FSkinHint <> nil then FSkinHint.Free;
FSkinHint := nil;
end;
end;
procedure TSeSkinHint.SetSkinObject(const Value: string);
begin
FSkinObject := Value;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?