The Open Toolkit library  1.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Properties | List of all members
OpenTK.DisplayDevice Class Reference

Defines a display device on the underlying system, and provides methods to query and change its display parameters. More...

Public Member Functions

DisplayResolution SelectResolution (int width, int height, int bitsPerPixel, float refreshRate)
 Selects an available resolution that matches the specified parameters. More...
 
void ChangeResolution (DisplayResolution resolution)
 Changes the resolution of the DisplayDevice. More...
 
void ChangeResolution (int width, int height, int bitsPerPixel, float refreshRate)
 Changes the resolution of the DisplayDevice. More...
 
void RestoreResolution ()
 Restores the original resolution of the DisplayDevice. More...
 
override string ToString ()
 Returns a System.String representing this DisplayDevice. More...
 

Static Public Member Functions

static DisplayDevice GetDisplay (DisplayIndex index)
 Gets the DisplayDevice for the specified DisplayIndex. More...
 

Properties

Rectangle Bounds [get, set]
 Gets the bounds of this instance in pixel coordinates.. More...
 
int Width [get]
 Gets a System.Int32 that contains the width of this display in pixels. More...
 
int Height [get]
 Gets a System.Int32 that contains the height of this display in pixels. More...
 
int BitsPerPixel [get, set]
 Gets a System.Int32 that contains number of bits per pixel of this display. Typical values include 8, 16, 24 and 32. More...
 
float RefreshRate [get, set]
 Gets a System.Single representing the vertical refresh rate of this display. More...
 
bool IsPrimary [get, set]
 Gets a System.Boolean that indicates whether this Display is the primary Display in systems with multiple Displays. More...
 
IList< DisplayResolutionAvailableResolutions [get, set]
 Gets the list of DisplayResolution objects available on this device. More...
 
static IList< DisplayDeviceAvailableDisplays [get]
 Gets the list of available DisplayDevice objects. This function allocates memory. More...
 
static DisplayDevice Default [get]
 Gets the default (primary) display of this system. More...
 

Detailed Description

Defines a display device on the underlying system, and provides methods to query and change its display parameters.

Member Function Documentation

void OpenTK.DisplayDevice.ChangeResolution ( DisplayResolution  resolution)

Changes the resolution of the DisplayDevice.

Parameters
resolutionThe resolution to set. DisplayDevice.SelectResolution
Exceptions
Graphics.GraphicsModeExceptionThrown if the requested resolution could not be set.

If the specified resolution is null, this function will restore the original DisplayResolution.

void OpenTK.DisplayDevice.ChangeResolution ( int  width,
int  height,
int  bitsPerPixel,
float  refreshRate 
)

Changes the resolution of the DisplayDevice.

Parameters
widthThe new width of the DisplayDevice.
heightThe new height of the DisplayDevice.
bitsPerPixelThe new bits per pixel of the DisplayDevice.
refreshRateThe new refresh rate of the DisplayDevice.
Exceptions
Graphics.GraphicsModeExceptionThrown if the requested resolution could not be set.
static DisplayDevice OpenTK.DisplayDevice.GetDisplay ( DisplayIndex  index)
static

Gets the DisplayDevice for the specified DisplayIndex.

Parameters
indexThe DisplayIndex that defines the desired display.
Returns
A DisplayDevice or null, if no device corresponds to the specified index.
void OpenTK.DisplayDevice.RestoreResolution ( )

Restores the original resolution of the DisplayDevice.

Exceptions
Graphics.GraphicsModeExceptionThrown if the original resolution could not be restored.
DisplayResolution OpenTK.DisplayDevice.SelectResolution ( int  width,
int  height,
int  bitsPerPixel,
float  refreshRate 
)

Selects an available resolution that matches the specified parameters.

Parameters
widthThe width of the requested resolution in pixels.
heightThe height of the requested resolution in pixels.
bitsPerPixelThe bits per pixel of the requested resolution.
refreshRateThe refresh rate of the requested resolution in hertz.
Returns
The requested DisplayResolution or null if the parameters cannot be met.

If a matching resolution is not found, this function will retry ignoring the specified refresh rate, bits per pixel and resolution, in this order. If a matching resolution still doesn't exist, this function will return the current resolution.

A parameter set to 0 or negative numbers will not be used in the search (e.g. if refreshRate is 0, any refresh rate will be considered valid).

This function allocates memory.

override string OpenTK.DisplayDevice.ToString ( )

Returns a System.String representing this DisplayDevice.

Returns
A System.String representing this DisplayDevice.

Property Documentation

IList<DisplayDevice> OpenTK.DisplayDevice.AvailableDisplays
staticget

Gets the list of available DisplayDevice objects. This function allocates memory.

IList<DisplayResolution> OpenTK.DisplayDevice.AvailableResolutions
getset

Gets the list of DisplayResolution objects available on this device.

int OpenTK.DisplayDevice.BitsPerPixel
getset

Gets a System.Int32 that contains number of bits per pixel of this display. Typical values include 8, 16, 24 and 32.

Rectangle OpenTK.DisplayDevice.Bounds
getset

Gets the bounds of this instance in pixel coordinates..

DisplayDevice OpenTK.DisplayDevice.Default
staticget

Gets the default (primary) display of this system.

int OpenTK.DisplayDevice.Height
get

Gets a System.Int32 that contains the height of this display in pixels.

bool OpenTK.DisplayDevice.IsPrimary
getset

Gets a System.Boolean that indicates whether this Display is the primary Display in systems with multiple Displays.

float OpenTK.DisplayDevice.RefreshRate
getset

Gets a System.Single representing the vertical refresh rate of this display.

int OpenTK.DisplayDevice.Width
get

Gets a System.Int32 that contains the width of this display in pixels.