Author |
Topic: Wnndows 7 Display query (Read 1173 times) |
|
JFS
New Member
member is offline


Posts: 11
|
 |
Wnndows 7 Display query
« Thread started on: Apr 23rd, 2014, 07:51am » |
|
I have recently acquired a new machine running Win 7 64b - the same OS I use on two other systems. However, I now have an issue with my app which I have not previously observed.
On my other Win 7 machines (and all previous OS versions), if I change the dpi setting of the system, the dialog boxes created by my app and the fonts displayed within them would all resize appropriately. On the new system however, all the controls and their fonts remain the same size regardless of the dpi setting - though the window title, fonts I select within the app and system generated controls (ie MessageBoxes) are all resized as I would expect. This matters (only) because one of my dialog boxes displays a bitmap overlayed with Static controls into which text is written. My app detects the current dpi setting and this has always worked well regardless of the dpi setting on the user's system. Now however, this dialog only displays correctly when system dpi is set to 120.
I have two questions therefore:-
1. What "setting" on this system is causing this to happen? 2. How can my app "detect" this setting in order that it can react appropriately
Alternatively, can I modify the parameters in created the dialog box which will enable it to display correctly regardless of the users system settings?
Any help gratefully received as this has come as a complete shock occurring out of the blue in code which was written 8 or 9 years ago and which has survived three new incarnations of Windows!
Many thanks in anticipation,
Howard
|
|
Logged
|
Best Wishes,
Howard
|
|
|
rtr
Guest
|
 |
Re: Wnndows 7 Display query
« Reply #1 on: Apr 23rd, 2014, 08:21am » |
|
on Apr 23rd, 2014, 07:51am, JFS wrote:This matters (only) because one of my dialog boxes displays a bitmap overlayed with Static controls into which text is written. |
|
If you are using the current DPI setting to discover the dimensions of a dialogue box or its controls, you are going about things the wrong way. I don't think Windows has ever guaranteed any specific relationship between DPI and dialogue scaling.
Rather, you should either use the MapDialogRect API function to discover the appropriate scaling, or you should determine the size(s) of the dialogue box and its controls directly by calling GetWindowRect or GetClientRect. Either way should give consistent results whatever the DPI value.
Quote:1. What "setting" on this system is causing this to happen? 2. How can my app "detect" this setting in order that it can react appropriately |
|
I don't think that is the correct approach. You should never have assumed that you can predict the size of a dialogue box from the DPI (unless you can find some Microsoft documentation which says it is legitimate to do so).
Richard.
|
« Last Edit: Apr 23rd, 2014, 08:22am by rtr » |
Logged
|
|
|
|
JFS
New Member
member is offline


Posts: 11
|
 |
Re: Wnndows 7 Display query
« Reply #2 on: Apr 23rd, 2014, 08:43am » |
|
Many thanks Richard - in principle at least I think that might be easier than the way I was trying to do it.
Having said that, I am still curious as to why new my system insists on running my app as if I had set my dpi to 120 - it looks a lot better when it runs at the setting I actually use - which is 96.
Any thoughts?
|
|
Logged
|
Best Wishes,
Howard
|
|
|
rtr
Guest
|
 |
Re: Wnndows 7 Display query
« Reply #3 on: Apr 23rd, 2014, 11:20am » |
|
on Apr 23rd, 2014, 08:43am, JFS wrote: Not really. It would make more sense if it was the other way around - i.e. Windows was running your app at 96 DPI when the system is configured for a higher value such as 144 DPI. That is the default behaviour in modern versions of Windows unless you declare your application to be 'DPI aware' (which you can do by calling SetProcessDPIAware).
There's a table here of DPI settings for different display sizes and resolutions:
http://bb4w.wikispaces.com/Supporting+different+DPI+values
The vast majority of modern PC displays use flat-panel technologies which only work properly at their 'native' resolution, so there is usually only one 'correct' DPI value.
Richard.
|
« Last Edit: Apr 23rd, 2014, 11:25am by rtr » |
Logged
|
|
|
|
JFS
New Member
member is offline


Posts: 11
|
 |
Re: Wnndows 7 Display query
« Reply #4 on: Apr 23rd, 2014, 1:02pm » |
|
Just to clarify one detail - it is not that the appearance of my app remains unchanged at different dpi settings - just that the fonts in the dialogue boxes remain the same size - until you get to about 130dpi at which point there is a discontinuity and fonts suddenly get larger.
I have discovered that "Use XP Style dpi Scaling" being unticked changes things - in that the system then has the same effect on my app as changing the screen res - and it looks dreadful for the reasons you mentioned. Setting ProcessDPIAware causes the same effect.
But now that my bitmaps are scaling correctly I can live with it - the only slight issue remaining is that when the font suddenly changes size as mentioned, the horizontal scrollbars fail to appear on the List Boxes when they should which is frustrating, but perhaps a small issue.
But all of this has shown me that my app is now extremely dated - just writing in this forum, I can zoom using ctrl+Scrollwheel - would that my app was that clever...
Many thanks again,
|
« Last Edit: Apr 23rd, 2014, 1:03pm by JFS » |
Logged
|
Best Wishes,
Howard
|
|
|
rtr
Guest
|
 |
Re: Wnndows 7 Display query
« Reply #5 on: Apr 23rd, 2014, 2:56pm » |
|
on Apr 23rd, 2014, 1:02pm, JFS wrote:just writing in this forum, I can zoom using ctrl+Scrollwheel - would that my app was that clever... |
|
As you are probably aware, support for Ctrl+Scrollwheel zooming in the BB4W IDE's editing pane was one of the features added in v5.95a (although you must have selected a scalable font for it to work, not FixedSys!).
Supporting it in your own program is another matter of course, although not necessarily all that difficult depending on the nature of your application.
Richard.
|
|
Logged
|
|
|
|
JFS
New Member
member is offline


Posts: 11
|
 |
Re: Wnndows 7 Display query
« Reply #6 on: Apr 24th, 2014, 10:09am » |
|
Indeed yes, and thanks for that - though I confess I discovered the feature by accident rather than from reading the notes... My app basically creates a large bitmap which the users currently scroll or drag. Zoom is by creating a new bitmap with bigger images. Has any one written up a ctrl+scroll implementation before I go to try to re-invent a new wheel?
Many thanks,
|
|
Logged
|
Best Wishes,
Howard
|
|
|
rtr
Guest
|
 |
Re: Wnndows 7 Display query
« Reply #7 on: Apr 24th, 2014, 10:37am » |
|
on Apr 24th, 2014, 10:09am, JFS wrote:Has any one written up a ctrl+scroll implementation before I go to try to re-invent a new wheel? |
|
Could you use StretchBlt or SetWorldTransform?
Richard.
|
|
Logged
|
|
|
|
JFS
New Member
member is offline


Posts: 11
|
 |
Re: Wnndows 7 Display query
« Reply #8 on: Apr 24th, 2014, 5:22pm » |
|
on Apr 24th, 2014, 10:37am, Richard Russell wrote:Could you use StretchBlt or SetWorldTransform?
|
|
I will look into the suggestions - many thanks Richard.
|
|
Logged
|
Best Wishes,
Howard
|
|
|
|