Icon

Qualified name: delphivcl.Icon

class Icon

Bases: Graphic

TIcon is an encapsulation of a Windows icon. Use TIcon to represent one of the icons in an image list. Assign an icon to objects that have an Icon property, such as TForm or TPicture. Icon objects represent the value loaded from a Windows icon file (.ICO file). Draw an icon on a canvas, using the Draw method of the TCanvas object. Icons do not stretch, so do not use StretchDraw (TCanvas) with an icon.

Note: TIcon can be used to display the value of a multi-resolution (>16 color) icon. However, it can not support the creation of multi-resolution icons, nor the resizing of the image after it is loaded from a file or stream.

Methods

Assign

Copies an icon image from another TIcon object.

AssignTo

Copies an icon image to a TBitmap graphical object.

CanLoadFromStream

Vcl.Graphics.TIcon.CanLoadFromStream inherits from Vcl.Graphics.TGraphic.CanLoadFromStream.

LoadFromClipboardFormat

Prevents applications from loading icons from the clipboard.

LoadFromResourceID

Embarcadero Technologies does not currently have any additional information.

LoadFromResourceName

Loads an icon resource into the icon object.

LoadFromStream

Loads the icon from a stream.

ReleaseHandle

SaveToClipboardFormat

Prevents applications from saving icons to the clipboard.

SaveToStream

Saves the icon to a stream.

SetSize

Specifies the size of the icon.

Attributes

ClassName

Returns the TObject.ClassName

Empty

Handle

HandleAllocated

Height

IconImage

IconImage:

ImageCount

int:

Images

List<Vcl.Graphics.TIconRec>:

IsAnimating

bool:

Modified

Palette

PaletteModified

ScaledDrawer

Returns the reference to the scaled drawer.

SupportsPartialTransparency

Indicate whether graphic supports partial transparency or an alpha channel.

Transparent

Width

Assign(Source: Persistent) None

Copies an icon image from another TIcon object. Call Assign to copy another icon object. Assign copies the icon image from the Source parameter if it is another TIcon object. Otherwise, Assign calls the inherited method, which copies the icon image from any source object that specifies how to copy to a TIcon in its AssignTo method.

AssignTo(Dest: Persistent) None

Copies an icon image to a TBitmap graphical object. Call AssignTo to copy an icon to a TBitmap object. AssignTo copies the icon image to the Dest parameter if it is a TBitmap object. Otherwise, AssignTo fails. The preferred way to copy an icon image to a bitmap is to use the Assign method of the TBitmap class, passing the icon object as the Source parameter.

Note: The bitmap resulted after a call to AssignTo always has alpha channel (transparency) information and a 32-bit color depth.

CanLoadFromStream(Stream: Stream) bool

Vcl.Graphics.TIcon.CanLoadFromStream inherits from Vcl.Graphics.TGraphic.CanLoadFromStream. All content below this line refers to Vcl.Graphics.TGraphic.CanLoadFromStream. CanLoadFromStream returns True when a specified stream contains a streamed image of a specific TGraphic subclass. The method uses current stream position, it does not change current stream position.

IconImage

IconImage:

ImageCount

int:

Images

List<Vcl.Graphics.TIconRec>:

LoadFromClipboardFormat(AFormat: int, AData: int, APalette: int) None

Prevents applications from loading icons from the clipboard. LoadFromClipboardFormat is overridden in TIcon because the clipboard format is not supported.

LoadFromResourceID(Instance: int, ResID: int) None

Embarcadero Technologies does not currently have any additional information.

LoadFromResourceName(Instance: int, ResName: str) None

Loads an icon resource into the icon object. LoadFromResourceName loads the specified icon resource from a module’s executable file. Instance is the handle of the module that contains the resource. ResName is the name of the resource to load.

LoadFromStream(Stream: Stream) None

Loads the icon from a stream. Use LoadFromStream to read the icon image from a stream. Set the Stream parameter to a stream object that provides access to the memory image of the icon. To load the icon from a .ico file, use the LoadFromFile method. To load the icon from the Clipboard, use the LoadFromClipboardFormat method.

ReleaseHandle()
SaveToClipboardFormat(Format: int, Data: int, APalette: int) None

Prevents applications from saving icons to the clipboard. SaveToClipboardFormat is overridden in TIcon because the format is not supported for the Clipboard.

SaveToStream(Stream: Stream) None

Saves the icon to a stream. Use SaveToStream to write the icon image to a stream. Specify the Stream parameter as the stream object that receives the memory image of the icon. To write the icon to a .ico file, use the SaveToFile method. To write the icon to the Clipboard, use the SaveToClipboardFormat method.

SetSize(AWidth: int, AHeight: int) None

Specifies the size of the icon. Use the SetSize method to set both the height and width of the icon. This results in better performance than setting the height and width separately.