如何为分辨率为1080 * 1920的系统开发win表单应用程序


我想开发一个 Windows 窗体应用程序,其中目标系统的屏幕分辨率为 1080x1920。

但是我的系统不接受该分辨率。 即使我无法将我的 winform 大小设置为 1080x1920。任何人都可以帮助我解决这个问题吗

这对

我有用。这是窗体的 Load 事件(可以通过在设计器中双击窗体来生成此事件(。在这种情况下,我们检查包含表单的屏幕的当前尺寸。然后我们设置表单大小以匹配。我们还将表单的位置移动到 0, 0,这样它就不会从屏幕上剪下来。

    //the name of this function will be different for you.
    //generate this function by double clicking the form in designer.
    //the code inside the function is what you're interested in.
    private void MainForm_Load(object sender, EventArgs e)
    {
        Rectangle screenSize = Screen.GetBounds(this); //find out the current screen size
        this.Top = 0; //move the form to top
        this.Left = 0; //move the form to left
        this.Width = screenSize.Width; //set form width to screen width
        this.Height = screenSize.Height; //set form height to screen height
    }

编辑:另外,为什么不最大化?

        this.WindowState = FormWindowState.Maximized;

最新更新