我想知道 winform 显示器是否可以找到并显示它当前显示的当前屏幕分辨率?
例如,如果我的屏幕是 1920 x 1080,它将在标签或打印行中显示。尽管后一部分是我已经知道该怎么做的事情。
如果winform可以找到这些数据,有人可以告诉我吗?
使用屏幕类
label1.Text = string.Format("Primary screen size = {0}x{1}",
Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
是的,当然,c#和WinForms可以获取你当前的屏幕分辨率,试试这段代码
Rectangle resolution = Screen.PrimaryScreen.Bounds;
int w = resolution.Width;
int h = resolution.Height;
或者您可以尝试将其显示为标签或消息框
label1.Text = Screen.PrimaryScreen.Bounds.Width.ToString() + "x" + Screen.PrimaryScreen.Bounds.Height.ToString();