在vb.net中引用屏幕高度和宽度
答
您可以使用:
My.Computer.Screen.Bounds
或:
Screen.PrimaryScreen.Bounds
Bounds是提供大小的矩形。或者,您可以查看WorkingArea,其中不包括任务栏和停靠窗口。
答
对于WPF可以使用:
System.Windows.SystemParameters.PrimaryScreenWidth
System.Windows.SystemParameters.PrimaryScreenHeight
答
您可以使用类似:
My.Computer.Screen.Bounds.Size.Width
My.Computer.Screen.Bounds.Size.Height
答
插入此代码到的Form_Load。我把一些决议...
Dim dw As Double
Dim dh as Double
Width = Screen.PrimaryScreen.Bounds.Width
If (Width = 1366) Then
dw = 1
ElseIf (Width = 1920) Then
dw = 1.4055
ElseIf (Width = 1280) Then
dw = 0.9379
End If
For Each c As Control In Me.Controls
c.Width = CInt(CDbl(c.Width * dw))
Next
Height = My.Computer.Screen.Bounds.Size.Height
If (Height = 768) Then
dh = 1
ElseIf (Height = 1080) Then
dh = 1.4062
ElseIf (Height = 1024) Then
dh = 1.3333
End If
For Each g As Control In Me.Controls
g.Height = CInt(CDbl(g.Height * dh))
Next
+0
考虑向您的代码添加解释 – arghtype 2014-10-31 13:20:09
答
昏暗的高度整数= Screen.PrimaryScreen.Bounds.Height 昏暗的宽度整数= Screen.PrimaryScreen.Bounds.Width
所以对于右下角比如什么可不可能是? – Cyclone 2009-08-28 00:00:27
没关系,明白了!谢谢! – Cyclone 2009-08-28 00:25:41