问题描述
我有VB应用程序,当前的宽度和高度为1366 x 768.
I have VB application and with current width and height as 1366 x 768.
现在,当我在不同的PC上使用相同的应用程序(具有不同的屏幕分辨率,例如1920 x 1060)时,我的应用程序不会自动缩放.有什么方法可以自动缩放应用程序以自动填充屏幕?
Now when I use the same application on different PC (with different screen resolution, for example 1920 x 1060), my application do not scale automatically. Is there some way to auto scale the application to fill the screen (automatically)?
预先感谢.
推荐答案
我有VB应用程序,当前的宽度和高度为1366 x 768.
I have VB application and with current width and height as 1366 x 768.
现在,当我在不同的PC上使用相同的应用程序(具有不同的屏幕分辨率,例如1920 x 1060)时,我的应用程序不会自动缩放.有什么方法可以自动缩放应用程序以自动填充屏幕?
Now when I use the same application on different PC (with different screen resolution, for example 1920 x 1060), my application do not scale automatically. Is there some way to auto scale the application to fill the screen (automatically)?
谢谢.
您可以在启动时设置表单的大小.您可以通过以下方式获取WorkingArea/Monitor的大小:
you can set the Size of the Form on startup. You can get the Size of the WorkingArea/Monitor with:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim r As Rectangle = Screen.GetWorkingArea(Me)
Me.Size = New Size(r.Width - 200, r.Height - 100)
Me.Location = New Point(100, 50)
End Sub
或使用Screen.GetBounds(Me)获取整个显示器的显示区域.
or use Screen.GetBounds(Me) for getting the entire monitor displayarea.
此致
托尔斯滕
这篇关于VB应用程序和不同的PC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!