且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

全屏Windows窗体超出屏幕尺寸

更新时间:2023-12-06 16:32:46

这是我使用全屏的代码。我创建了一个全屏属性我的形式,当我需要,我将 this.FullScreen = TRUE;

Here is the code I use for fullscreen. I create a FullScreen property for my form and when I need, I set this.FullScreen = true;

private bool fullScreen = false;
[DefaultValue(false)]
public bool FullScreen
{
    get
    {
        return fullScreen;
    }
    set
    {
        fullScreen = value;

        if (value)
        {
            //this.SuspendLayout();
            this.WindowState = FormWindowState.Normal;
            FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            WindowState = FormWindowState.Maximized;
            //this.ResumeLayout(true);
        }
        else
        {
            this.Activate();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
        }
    }
}