vb如何获取屏幕分辨率
我用的是vs2010,想获得屏幕分辨率,然后改变窗体大小
在网上搜到的
Dim x As Integer, y As Integer
x = Screen.Width / Screen.TwipsPerPixelX
y = Screen.Height / Screen.TwipsPerPixelY
不能用 vb 2010 获取屏幕分辨率
[解决办法]
Dim ScreenArea As Rectangle = System.Windows.Forms.Screen.GetWorkingArea(Me)
Me.Size = New System.Drawing.Size(ScreenArea.Width, ScreenArea.Height)
[解决办法]
Dim desktopSize As Size = System.Windows.Forms.SystemInformation.PrimaryMonitorSize
Dim height As Integer = desktopSize.Height
Dim width As Integer = desktopSize.Width
[解决办法]
Dim x As Integer, y As Integer
x = Screen.Width / Screen.TwipsPerPixelX
y = Screen.Height / Screen.TwipsPerPixelY
=>这是vb的语法
你是不是在.NET中跑的啊,
如果是Vb.Net的话,试试下面的吧
Dim x, y As Long
x = Screen.PrimaryScreen.Bounds.Width.ToString
y = Screen.PrimaryScreen.Bounds.Height.ToString
[解决办法]
我开了个帖子问这个问题,有个大牛给我写了代码,你可以去看看那个帖子