BBC BASIC for Windows
« Screen size »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:27pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Screen size  (Read 875 times)
Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Screen size
« Thread started on: Sep 5th, 2013, 4:39pm »

Hi,

I've been playing around with various windows functions and the SYS "GetDeviceCaps", @memhdc%, HORZSIZE seems to give the wrong size. (I'm assuming that @memhdc% is the right DC to give reference to the screen.) Although HORZRES, VERTRES, LOGPIXELSX, LOGPIXELSY gives the correct values, HORZSIZE and VERTSIZE give incorrect almost twice what it should be. Is this me missing something, or is it the system reporting incorrectly?

Matt

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Screen size
« Reply #1 on: Sep 5th, 2013, 5:23pm »

on Sep 5th, 2013, 4:39pm, Matt wrote:
Is this me missing something, or is it the system reporting incorrectly?

It's extremely unlikely that there is a fault in the API that Microsoft are unaware of, and if by any chance that is the case you should be reporting it to them, not here! wink

By my reckoning the relationship between HORZRES (which returns pixels) and HORZSIZE (which returns 'millimetres') is as follows:

millimetres = pixels / DPI * 25.4

In other words divide the number of pixels by the dots-per-inch value to give inches, and then multiply by the number of millimetres in an inch.

If you appear to be getting the wrong value back the first thing I would check is that the DPI setting on your PC really does correspond, at least approximately, to the pixels-per-inch value for your display. It is not uncommon for the DPI to be set to 96 (the 'standard' value) even when the display is nowhere near that.

There is a table of DPI values for various display sizes here:

http://bb4w.wikispaces.com/Supporting+different+DPI+values

Richard.
« Last Edit: Sep 5th, 2013, 5:24pm by admin » User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Screen size
« Reply #2 on: Sep 5th, 2013, 8:24pm »

on Sep 5th, 2013, 5:23pm, Richard Russell wrote:
If you appear to be getting the wrong value back the first thing I would check is that the DPI setting on your PC really does correspond, at least approximately, to the pixels-per-inch value for your display. It is not uncommon for the DPI to be set to 96 (the 'standard' value) even when the display is nowhere near that.

Yes, thanks. By my calculation the dpi value should be 122 rather than the 96 standard it's set at. Putting it to 122 sets the standard fonts too small to read comfortably, which is probably why it's set so. But the system's calculations seem to be OK.

Thanks

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Screen size
« Reply #3 on: Sep 5th, 2013, 10:36pm »

on Sep 5th, 2013, 8:24pm, Matt wrote:
Putting it to 122 sets the standard fonts too small to read comfortably, which is probably why it's set so.

Ahem - changing the DPI value from 96 to 120 increases the font size by 25%! So a typical font size of, say, 12 point will be about 16 pixels high at 96 DPI but about 20 pixels high at 120 DPI.

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Screen size
« Reply #4 on: Sep 6th, 2013, 04:38am »

on Sep 5th, 2013, 10:36pm, Richard Russell wrote:
Ahem - changing the DPI value from 96 to 120 increases the font size by 25%! So a typical font size of, say, 12 point will be about 16 pixels high at 96 DPI but about 20 pixels high at 120 DPI.

You're absolutely right. I'd fiddled around with the setting so much and my mind was on something else as well, that I was obviously not thinking. Now that I'm more than half awake this morning - The font size of 122 increases the size unusableably on my small screen. (Although, if I was doing something that was absolutely necessary to require an acurate size match I might be tempted.) I also tried 1/2 size to see what that was like and that was too small to be useful.

Thanks Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls