To create an
object suitable for drawing on an given pane, use one of
or (on Microsoft Windows)
Images need to be freed after use. When the pane that an image was created for is destroyed, the image is freed automatically. However if you want to remove the image before the pane is destroyed, you must make an explicit call
. If the image is not freed, then a memory leak will occur.
Another way to create an
object is to supply a registered image identifier in a CAPI class that suports images. For example you can specify an
. Then, an
object is created implicitly when the pinboard object is displayed and freed implicitly when the pinboard object is destroyed.
In all cases, the functions that create the
object require the pane to be already created. So if you are displaying the image when first displaying your window, take care to create the
object late enough, for example in the
of the interface or in the first
of the pane.