Print Page | Close Window

Animated GIF in XAML not showing

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=23155
Printed Date: 04 October 2024 at 9:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Animated GIF in XAML not showing
Posted By: evoX
Subject: Animated GIF in XAML not showing
Date Posted: 06 October 2016 at 6:03am
I have this code to load an animated GIF from resource

HBITMAP hbm = NULL;
CBitmap bmpLogo;
BOOL bAlpha = TRUE;

UINT nImageID = 1;
hbm = CXTPImageManagerIcon::LoadBitmapFromResource(m_hResourceModule, MAKEINTRESOURCE(IDR_GIF_ROTATING_GEAR), &bAlpha);

bmpLogo.Attach(hbm);
XTPImageManager()->RemoveIcon(nImageID);
XTPImageManager()->SetIcons(bmpLogo, &nImageID, 1, CSize(0, 0), xtpImageNormal, TRUE);

In resource the image is added as a custom resource called GIF

The Image ID is set correctly in XAML, but the GIF is not displayed. I also have tried to set the CSize to 64,64 as the GIF size, but the same result. 


-------------
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)



Replies:
Posted By: olebed
Date Posted: 12 October 2016 at 4:28am
Hello evoX,

You can explore our sample Samples\Utilities\MarkupPad,  load file Markups\Smiles.xaml
<Image Source='file://Markups\Smiles\3.gif'

Regards,
 Oleksandr Lebed


Posted By: evoX
Date Posted: 13 October 2016 at 10:05am
I have seen the sample, from a stand alone .GIF file it works, but loading it from resource does not work :(

-------------
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)


Posted By: olebed
Date Posted: 13 October 2016 at 10:12am
Oh, you mean that necessary picture is in some DLL..


Posted By: evoX
Date Posted: 14 October 2016 at 10:44am
Yes, a resource DLL, from where I load all the other images displayed in XAML. PNG and JPG images are displayed without any problem, only the GIF files don't work from DLL.

-------------
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)


Posted By: agontarenko
Date Posted: 09 November 2016 at 6:35am
Hello evoX,

Visual Studio doesn't support gif as image resource.
You can add gif to resources, and when application will start, unpack gif file to tmp directory and set in XAML this path.
<Image Source='file://TMP_DIR\Smiles\3.gif>

Regards,
Gontarenko Artem


Posted By: evoX
Date Posted: 26 November 2016 at 7:06am
Thanks! But why not load to memory and display it in xaml? I think that this is a toolkit pro limitation, not Visual Studio, because PNG images also are custom resources and not a standard VS resource and PNGs are displayed in XAML.

-------------
Product: Xtreme ToolkitPro 19.30
Platform: Windows 10 64bit
Language: Visual C++ (VS 2019)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net