ScreenPixelsWidth Property

Returns the approximate width of the display, in pixels. The default value is 96.

public virtual int ScreenPixelsWidth {
   get
}

Remarks

This value can be derived from the assumed character size and actual screen pixel size. The algorithm for determining the height uses a combination of the default sizes (from the .config file), device-specific sizes (again, in the .config file) and explicit headers sent by the devices. These values are not necessarily exact (that is, for width, especially for variable-width fonts, these values are approximate).

This value is calculated using the following algorithm.

if this["screenPixelsWidth"] is not null, 
   then return this["screenPixelsWidth"]; 
else, if this["screenCharactersWidth"] is not null and this["characterWidth"] is not null, 
   then return this["screenCharactersWidth"] * this["characterWidth"]; 
else, if this["screenCharactersWidth"] is not null, 
   then return this["screenCharactersWidth"] * this["defaultCharacterWidth"]; 
else, if this["characterWidth"] is not null, 
   then return this["defaultScreenCharacterWidth"] * this["characterWidth"]; 
else, return this["defaultScreenPixelsWidth"]

Note   You cannot rely on the following statement

   this.ScreenPixelsWidth == this["screenPixelsWidth"]

See Also

Applies to: MobileCapabilities Class