[nsbasic-ce] TwipsPerPixel

2010-02-03 Thread michiman56
I've noticed that while some controls return dimensional properties in Twips 
and most expect such properties in Pixels there is a need to determine the 
TwipsPerPixel value - which can vary.  However I haven't found a clean way to 
get this value from API calls since Output.hDC doesn't exist and nothing seems 
to be built into NS Basic/CE (or I've missed it).

According to 
http://windowsteamblog.com/blogs/windowsphone/archive/2009/09/02/widget-anatomy-the-keys-for-a-great-user-experience.aspx
 a rough aproximation can be achieved by dividing the world into 96 DPI and 192 
DPI devices.

This would let me do something like:

If Output.Width = 480 Then
  TwipsPerPixel = 7.5
Else
  TwipsPerPixel = 15
End If

Is this more or less what people are doing?  Is there an alternative?  Have I 
missed some general guidelines on Hi DPI device support someplace?

-- 
You received this message because you are subscribed to the Google Groups 
nsb-ce group.
To post to this group, send email to nsb...@googlegroups.com.
To unsubscribe from this group, send email to 
nsb-ce+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en.



Re: [nsbasic-ce] TwipsPerPixel

2010-02-03 Thread George Henne
There are some useful new calls in the latest build, that are not fully
documented yet. They let you check what the devices DPI setting is properly.

SYSINFO(number)

SYSINFO returns information about the device. This is not a complete
list of return values: see Microsoft's documentation on GetSystemMetrics
and GetDeviceCaps for more.

SM_CXSCREEN 0   Width of screen
SM_CYSCREEN 1   Height of screen
SM_CXVSCROLL2   Width of arrow bitmap on vertical scroll bar
SM_CYHSCROLL3   Height of arrow bitmap on horizontal scroll bar
SM_CYCAPTION4   Height of caption or title
SM_CXDLGFRAME   7   Width of dialog frame window
SM_CYDLGFRAME   8   Height of dialog frame window
SM_CYMENU   15  Height of menu
SM_CXFULLSCREEN 16  Width of window client area
SM_CYFULLSCREEN 17  Height of window client area
SM_CYVSCROLL20  Height of arrow bitmap on horizontal scroll bar
SM_CXVSCROLL21  Height of arrow bitmap on vertical scroll bar
HORZREZ 108 HiRes Display width pixels
VERTREZ 109 HiRes Display height pixels
BITSPIXEL   112 Bits per pixel
NUMCOLORS   124 Number of colors
LOGPIXELSX  188 Pixels per inch horizontal
LOGPIXELSY  190 Pixels per inch vertical

Example

REM SYSINFO Example

MSGBOX The device's DPI is   sysInfo(188)

Output
The device's DPI is 96.



I've noticed that while some controls return dimensional properties in
Twips and most expect such properties in Pixels there is a need to
determine the TwipsPerPixel value - which can vary.  However I haven't
found a clean way to get this value from API calls since Output.hDC
doesn't exist and nothing seems to be built into NS Basic/CE (or I've
missed it).

According to http://windowsteamblog.com/blogs/windowsphone/archive/
2009/09/02/widget-anatomy-the-keys-for-a-great-user-experience.aspx a
rough aproximation can be achieved by dividing the world into 96 DPI and
192 DPI devices.

This would let me do something like:

If Output.Width = 480 Then
  TwipsPerPixel = 7.5
Else
  TwipsPerPixel = 15
End If

Is this more or less what people are doing?  Is there an alternative? 
Have I missed some general guidelines on Hi DPI device support someplace?





Yahoo! Groups Links




-- 
You received this message because you are subscribed to the Google Groups 
nsb-ce group.
To post to this group, send email to nsb...@googlegroups.com.
To unsubscribe from this group, send email to 
nsb-ce+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nsb-ce?hl=en.