CXTPStatusBarPaintManager always uses small icon |
Post Reply |
Author | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
Posted: 01 April 2023 at 3:01pm |
On scaled desktops, the DrawStatsBarPaneEntry code always calls GetImage to retrive the smallest image. In our case, a 16 pixel wide image. The code then scales the image up. So, I have boxes that users scale 250%, 300% .. or even just 125%. They complain about the images on the status bar looking bad. Why isn't the rcItem rect passed in to get the icon whose with matches, or most closely matches, the rect width?
|
|
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 293 |
Post Options
Thanks(0)
|
Hello, To use different size icons you need: 1. Create ico file with different sizes 16,20,24,..... 2. To add icon with different sizes as below (StatusBar sample): void CMainFrame::AddSwitchButtons() { ... for (int i = 0; i < sizeof(switches) / sizeof(UINT); i++) { m_wndStatusBar.GetImageManager()->SetIcon(switches, switches, XTP_DPI_SIZE(CSize(16, 16))); } ... } After this you can to see different icon sizes with differentDPIs Also you can to use XAML icons with statusbar. See please sample. Regards, Artem Gontarenko
|
|
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 293 |
Post Options
Thanks(0)
|
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
Odd it is. I already provide scaled icons. But, when I stepped thru the status pane paint manager code I saw CJ call to get the image from the pane. The call had no args. Inside the method, the call to the image manager passed in zero for the size. The image manager then retrieved the smallest icon I had set, which was 16x16. Then the code wound thru the draw method and our icons are PNG so they have alpha and the CJ code called a GDI alpha blending API. I examined the API in the MSDN and the documentation said that half toning is not supported by the API. If it was a BMP file, CJ turns on half toning which helps the stretching of the image to a larger size. In the latest CJ, I also found the code relies on a flag to indicate if the image should be resized whereas older code used the DPI macro on the icon width and height. We don't turn on the general resizing code because we process all our images thru WIC to resize them (both bmp and png) as WIC does a better job that the GDI half toning. To address this I modified the code. I added a width parameter to the get image method
on the pane object and passed it to the image manager when the get image method called the image manager to find the icon. I modified the draw code and passed the rcItem.Width() to
the call the PM made. Then the image manager found my 20x20 icon and
returned it. At 200%, the rcItem width was 32 and the 32x32 icon was returned. As for XAML, unfortunately we have found no tool that lets us create XAML. There are a lot of tools that create SVG. But, none of our image creators have found a cost free tool to convert SVG to XAML that worked when we tried to use the resulting image in CJ. I sure would like to know of a tool to create XAML, especially if there is one that converts SVG to XAML, that would work with CJ. We have to deal with multiple platforms (and non-CJ based software) and I can obtain SVG images from the company but not XAML. The claim is SVG is prolific and has become some sort of de-facto standard and why can't we just "use SVG like everyone else". I believe our image creators use an Adobe tool to create SVG. At one time CJ was going to support SVG but then ... something happened and it never materialized? I was asked again just this week (coincidentally) when CJ would support SVG.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |