Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# OpenTK Windows应用程序屏幕大小?_C#_Visual Studio_Opengl_Opentk - Fatal编程技术网

C# OpenTK Windows应用程序屏幕大小?

C# OpenTK Windows应用程序屏幕大小?,c#,visual-studio,opengl,opentk,C#,Visual Studio,Opengl,Opentk,我正在用OpenTK做一个小项目,我想得到主显示器的屏幕分辨率。我的应用程序是windows应用程序,我已尝试使用 width=Screen.PrimaryScreen.Bounds.width 但是名称“screen”在当前上下文中不存在。我已经包含了所需的using语句,是否有其他方法获得屏幕大小 尝试使用显示设备 int width = DisplayDevice.Default.Width; int height = DisplayDevice.Default.Height; 您是

我正在用OpenTK做一个小项目,我想得到主显示器的屏幕分辨率。我的应用程序是windows应用程序,我已尝试使用
width=Screen.PrimaryScreen.Bounds.width


但是名称“screen”在当前上下文中不存在。
我已经包含了所需的using语句,是否有其他方法获得屏幕大小

尝试使用
显示设备

 int width = DisplayDevice.Default.Width;
 int height = DisplayDevice.Default.Height;

您是否添加了对
System.Windows.Forms
的引用?这就是定义
屏幕的地方。