Sign in Join
FPDoc Onlineexperiment

TCustomIcon.UnshareImage procedure

Member of TCustomIconprotectedIn unit Graphics

Unshares the shared image when the content in the icon is changed.

Declaration

pascal
procedure UnshareImage(CopyContent: Boolean); override

Description

UnshareImage is an overridden procedure used to stop sharing the image(s) for the icon. UnshareImage implements the abstract virtual method defined in the ancestor class.

No actions are performed in the method when the RefCount for the internal TSharedIcon instance is less than 1.

When sharing is stopped, the internal TSharedIcon instance in the class is re-created.

CopyContent indicates whether existing content from icon images is copied into the new image list. When set to True, TIconImage instances are re-created for each of the icon images and their existing content is copied. When set to False, image data for the icon is empty.

UnshareImage calls FreeCanvasContext to discard the device context used in the Canvas.

UnshareImage calls the Release method for the old TSharedIcon instance.

UnshareImage is called from methods which alter the handle or image content for the icon, including:

  • SetHandle
  • Add
  • Assign
  • AssignImage
  • Delete

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.