How to load a single icon from the resources of another file using Delphi?
Use CreateIconFromResourceEx
instead of CreateIconFromResource
.
CreateIconFromResourceEx
lets you provide desired width/height, while CreateIconFromResource
is using default system mertics for those (such as explained for LR_DEFAULTSIZE
):
Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.