Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - CXTPStatusBarPaintManager always uses small icon
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPStatusBarPaintManager always uses small icon

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPStatusBarPaintManager always uses small icon
    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?
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2023 at 7:44am
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
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2023 at 7:54am
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2023 at 11:20am
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

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

This page was generated in 0.152 seconds.