2017-02-20 67 views
0

我正在开发OpenTK中的一个小项目,我想获得主监视器的屏幕分辨率。我的应用程序是一个Windows应用程序,我试图使用
width = Screen.PrimaryScreen.Bounds.Width;
但在当前上下文中不存在名称'屏幕'。
我已经包含了所需的使用语句,有没有其他方法来获取屏幕大小?OpenTK Windows应用程序的屏幕大小?

+0

你添加到'System.Windows.Forms'参考?这就是'屏幕'被定义的地方。 –

回答

1

尝试使用DisplayDevice

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

Source here

+0

谢谢!这工作完美 – KrystianB

相关问题