如何使我的表格在当前屏幕上填满整个屏幕

问题描述 投票:0回答:2

我正在处理一个项目,我需要让表单填满整个屏幕

            Me.Height = Screen.PrimaryScreen.Bounds.Height
            Me.Width = Screen.PrimaryScreen.Bounds.Width
            Me.FormBorderStyle = FormBorderStyle.None
            Me.Location = New Point(Screen.AllScreens(0).Bounds.X, 
            Screen.AllScreens(0).Bounds.Y)
            Me.Height = Screen.PrimaryScreen.Bounds.Height
            Me.Width = Screen.PrimaryScreen.Bounds.Width
            Me.FormBorderStyle = FormBorderStyle.None

这适用于在主屏幕的任何一个屏幕上填满整个屏幕,我的问题是在使用多个监视器时(我使用3)我如何获得屏幕表格,并在屏幕上全屏显示不只是跳到我的主屏幕?

vb.net
2个回答
0
投票

没关系,我喝了一点咖啡......

        Me.Height = Screen.FromControl(Me).Bounds.Height
        Me.Width = Screen.FromControl(Me).Bounds.Width
        Me.FormBorderStyle = FormBorderStyle.None
        Me.Location = New Point(Screen.FromControl(Me).Bounds.X, 
        Screen.FromControl(Me).Bounds.Y)
        Me.Height = Screen.FromControl(Me).Bounds.Height
        Me.Width = Screen.FromControl(Me).Bounds.Width
        Me.FormBorderStyle = FormBorderStyle.None

0
投票

WinForm上有一个名为WindowState的属性。将此设置为最大化。表单将自动填充整个监视器。

Form1.WindowState = Maximized
© www.soinside.com 2019 - 2024. All rights reserved.