本文整理汇总了C#中OpenTK.DisplayDevice.SelectResolution方法的典型用法代码示例。如果您正苦于以下问题:C# DisplayDevice.SelectResolution方法的具体用法?C# DisplayDevice.SelectResolution怎么用?C# DisplayDevice.SelectResolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenTK.DisplayDevice
的用法示例。
在下文中一共展示了DisplayDevice.SelectResolution方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayResolution
/// <summary>
/// Creates a new DisplayResolution object for the specified DisplayDevice.
/// </summary>
/// <param name="width">The requested width in pixels.</param>
/// <param name="height">The requested height in pixels.</param>
/// <param name="bitsPerPixel">The requested bits per pixel in bits.</param>
/// <param name="refreshRate">The requested refresh rate in hertz.</param>
/// <remarks>OpenTK will select the closest match between all available resolutions on the specified DisplayDevice.</remarks>
///
public DisplayResolution(int width, int height, int bitsPerPixel, float refreshRate, DisplayDevice device)
{
// Refresh rate may be zero, since this information may not be available on some platforms.
if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be greater than zero.");
if (bitsPerPixel <= 0) throw new ArgumentOutOfRangeException("bitsPerPixel", "Must be greater than zero.");
if (refreshRate < 0) throw new ArgumentOutOfRangeException("refreshRate", "Must be greater than, or equal to zero.");
if (device == null) throw new ArgumentNullException("DisplayDevice", "Must be a valid DisplayDevice");
DisplayResolution res = device.SelectResolution(width, height, bitsPerPixel, refreshRate);
this.width = res.width;
this.height = res.height;
this.bits_per_pixel = res.bits_per_pixel;
this.refresh_rate = res.refresh_rate;
}