TIcon( unit KOL.pas ) ï TObj ï _TObj
TIcon = object( TObj )
Object type to incapsulate icon or cursor image.
property Size: Integer;
Icon dimension (width and/or height, which are equal to each other always).
property Handle: HIcon;
Windows icon object handle.
property Empty: Boolean;
Ñ
Returns True if icon is Empty.
property ShareIcon: Boolean;
True, if icon object is shared and can not be deleted when TIcon object
is destroyed (set this flag is to True, if an icon is obtained from another
TIcon object, for example).
property HotSpot: TPoint;
Ñ
Hot spot point - for cursors.
procedure SetHandleEx( NewHandle: HIcon );
Set Handle without changing Size (Width/Height).
procedure Clear;
Clears icon, freeing image and allocated GDI resource (Handle).
procedure Draw( DC: HDC; X, Y: Integer );
Draws icon onto given device context. Icon always is drawn transparently
using its transparency mask (stored internally in icon object).
procedure StretchDraw( DC: HDC; Dest: TRect );
Draws icon onto given device context with stretching it to fit destination
rectangle. See also Draw.
procedure LoadFromStream( Strm: PStream );
Loads icon from stream. If stream contains several icons (of
different dimentions), icon with the most appropriate size is loading.
procedure LoadFromFile( const FileName: KOLString );
Load icon from file. If file contains several icons (of
different dimensions), icon with the most appropriate size is loading.
procedure LoadFromResourceID( Inst: Integer; ResID: Integer; DesiredSize: Integer );
Loads icon from resource. To load system default icon, pass 0 as Inst and
one of followin values as ResID:
IDI_APPLICATION Default application icon. IDI_ASTERISK Asterisk (used in informative messages). IDI_EXCLAMATION Exclamation point (used in warning messages). IDI_HAND Hand-shaped icon (used in serious warning messages). IDI_QUESTION Question mark (used in prompting messages). IDI_WINLOGO Windows logo.It is also possible to load icon from resources of another module, if pass instance handle of loaded module as Inst parameter.
procedure LoadFromResourceName( Inst: Integer; ResName: PKOLChar; DesiredSize: Integer );
Loads icon from resource. To load own application resource, pass
hInstance as Inst parameter. It is possible to load resource from
another module, if pass its instance handle as Inst.
procedure LoadFromExecutable( const FileName: KOLString; IconIdx: Integer );
Loads icon from executable (exe or dll file). Always default sized icon
is loaded. It is possible also to get know how much icons are contained
in executable using gloabl function GetFileIconCount. To obtain icon of
another size, try to load given executable and use LoadFromResourceID
method.
procedure SaveToStream( Strm: PStream );
Saves single icon to stream. To save icons with several different
dimensions, use global procedure SaveIcons2Stream.
procedure SaveToFile( const FileName: KOLString );
Saves single icon to file. To save icons with several different
dimensions, use global procedure SaveIcons2File.
function Convert2Bitmap( TranColor: TColor ): HBitmap;
Converts icon to bitmap, returning Windows GDI bitmap resource as
a result. It is possible later to assign returned bitmap handle to
Handle property of TBitmap object to use features of TBitmap.
Pass TranColor to replace transparent area of icon with given color.
[ Index ]
This help is generated 14-Jun-2010 by KOL Help generator, (C) 2000-2001 by Vladimir Kladov
Modified (C) 2003 by Alexander Bartov