Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - DPI Scaling Related ContextMenu Drawing Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

DPI Scaling Related ContextMenu Drawing Problem

 Post Reply Post Reply
Author
Message
mschumi_41 View Drop Down
Newbie
Newbie


Joined: 06 July 2022
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote mschumi_41 Quote  Post ReplyReply Direct Link To This Post Topic: DPI Scaling Related ContextMenu Drawing Problem
    Posted: 16 March 2023 at 11:35am
Hello Codejock Team,
we encountered a context menu drawing problem. We are currently the Xtreme Toolkit Pro version 20.3.0.
Here is the reproduction:
- Occurs only in a multi-monitor setup; monitor resolution does not matter (both monitors can have the same display resolution; in my case 1920 x 1080)
- The scaling (the percentage value "size of text, apps, and other items) must be set different to reproduce the problem (in my setup: main monitor 100%, secondary monitor 125%).
- Start the program; it is opened on the main monitor
- Open a dialog where a context menu can be shown when the right mouse button is clicked upon the dialog
- Drag the dialog to the secondary monitor; as soon as more than half the dialog is dragged to the other monitor, it enlarges (because secondary monitor's scaling is on 125%)
- Now right-click on the dialog
- Here finally comes the problem
   - the context menu's shadows (right and bottom) are drawn in the correct place and size
   - however, the context menu's contents is drawn more to the upper left and in a smaller size that matches the main monitor's scaling


I checked what is called and found the following:
- our code looks as follows

with pCommandBars= nullptr or the MainFrame's command bars:
CXTPPopupBar* pPopup = CXTPPopupBar::CreatePopupBar(pCommandBars);
pPopup.LoadMenu(pMenu)
CXTPCommandBars::TrackPopupMenu(pPopup, flags, inX, inY, /*pWnd=*/nullptr, /*rcExclude=*/nullptr, /*pWndOwner=*/nullptr);

- on the XTP side is called:
- CXTPPopupBar::Popup(CXTPControlPopup* pControlPopup) with
- Animate (here something goes wrong)
   paintDC.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), pDC, rcWindow.left,                           rcWindow.top, SRCCOPY);
   ...
   GetPaintManager()->Animate(&paintDC, &animationDC, rcClient, animationType);
- and for the Shadows (works correctly)
   pPaintManager->GetShadowManager()->SetShadow(this, m_rcExclude, m_bRecursePopup ? 1 : 0);

- I changed one of the Codejock sample programs (CommandBars\HelpContext) and made the AboutDlg to have such a context menu. This reproduces the problem.
- I can send you the modified HelpContext sources  if it is needed

That is all for the moment; is this a bug or am I doing something wrong?

Thank you in advance and best regards,
Michael
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.172 seconds.