Strange Ribbon Group layout on 4k w/ scaling |
Post Reply |
Author | |
garrettd
Newbie Joined: 31 May 2022 Location: Huntsville, AL Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 31 May 2022 at 5:59pm |
Normally when I have a RibbonGroup with xtpButtonIconAndCaption controls, the controls are drawn three to a column within the group. However, on a 4k monitor at 200% scaling, only two controls are drawn to a column, resulting in a lot of wasted space. I've traced the problem down to CXTPRibbonGroup::OnCalcDynamicSize(CDC* pDC) in Source\Ribbon\XTPRibbonGroup.cpp. The variable nResultHeight is calculated based on the edit height (x3) plus some padding that winds up being XTP_DPI_Y(1). However, when looping through controls, the control height is calculated based on the control text font. At 4k resolution and 200% scaling, the discrepancy between the edit height and the font height makes OnCalcDynamicSize() think it can only fit two controls in a column.
Has anyone run into this issue before and found a good fix? We are hesitant to change the font size right now, so I'm thinking it might be best to adjust the padding in the calculation for nResultHeight instead. CalcGroupsHeight() adds XTP_DPI_Y(10) and then OnCalcDynamicSize() subtracts XTP_DPI(9) for the nResultHeight calculation - does anyone know where these values came from? Potential side effects for subtracting less? Thanks, Garrett
|
|
Fredrik
Senior Member Joined: 22 June 2005 Status: Offline Points: 235 |
Post Options
Thanks(0)
|
Hi,
Maybe your problem is same as DPI issues with PNG icons and XTP 20.1 - Codejock Developer Community? It doesn't really sound like that, but who knows - there's an error in GetLargeIconSize anyway. Try changing this function: CSize CXTPCommandBar::GetLargeIconSize(BOOL bAutoSize) const |
|
Windows 10, Visual Studio 20157, Toolkit Pro 18.3.0
|
|
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 |