Print Page | Close Window

MFC using xaml for HICON

Printed From: Codejock Forums
Category: General
Forum Name: XAML Snippets
Forum Description: Post your XAML snippets here for everyone to enjoy :)
Printed Date: 30 November 2023 at 3:17pm
Software Version: Web Wiz Forums 12.04 -

Topic: MFC using xaml for HICON
Posted By: Duane
Subject: MFC using xaml for HICON
Date Posted: 19 May 2023 at 11:34am
How can I create an HICON from an  XAML resource?

I've tried


But hIcon here is NULL.  

Is this possible?  I am able to add that resource to an image vector and use it for a ribbon without problem.

Posted By: astoyan
Date Posted: 28 May 2023 at 3:40pm
Hello Duane,

It is possible to make an HICON from XAML by rendering XAML into a bitmap and then making an icon from that bitmap manually. But that is not only a tedious work, but also a useless and pointless one as the whole point of having XAML icons is to ensure that you need only one XAML image to handle or possible icon sizes and to ensure a crisp and scalable image. Look for SetVectorIcon calls in ToolkitPro samples, like RibbonSample and similar.


Posted By: Duane
Date Posted: 29 May 2023 at 8:43am
Thanks for the reply.  I guess my question was poorly worded.  I am not specifically looking to convert an XAML into an HICON.  I want to be able to use the XAML as the frame icon.  I am able to use SetVectorIcon for the ribbon without problem.  But the frame icon in the sample is using CXTPFramePaintManager.  And this doesn't have a SetVectorIcon member.  

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 -
Copyright ©2001-2021 Web Wiz Ltd. -