void Fullscreen() { if (!panel2.Visible)//如果当前的窗体是最大化 { vlc_player_.SetFullScreen(true); this.WindowState = FormWindowState.Normal;//把当前窗体还原默认大小 panel1.Size = new Size(this.Size.Width, this.Size.Height - panel2.Size.Height); picBox.Size = panel1.Size; panel2.Visible = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; } else { vlc_player_.SetFullScreen(false); this.FormBorderStyle = FormBorderStyle.None;//将该窗体的边框设置为无,也就是没有标题栏以及窗口边框的 //this.WindowState = FormWindowState.Maximized;//将该窗体设置为最大化(方法1,适用于单一屏幕) Rectangle rect = new Rectangle(); rect = Screen.GetWorkingArea(this);//获取屏幕大小 this.Width = rect.Width; this.Height = rect.Width; this.Location = new Point(0, 0); panel1.Size = this.Size; picBox.Size = panel1.Size; panel2.Visible = false; } }
void Fullscreen() { if (this.WindowState == FormWindowState.Maximized)//如果当前的窗体是最大化 { vlc_player_.SetFullScreen(true); this.WindowState = FormWindowState.Normal;//把当前窗体还原默认大小 panel1.Size = new Size(this.Size.Width, this.Size.Height - panel2.Size.Height); panel2.Visible = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; } else { vlc_player_.SetFullScreen(false); this.FormBorderStyle = FormBorderStyle.None; //将该窗体的边框设置为无,也就是没有标题栏以及窗口边框的 this.WindowState = FormWindowState.Maximized; //将该窗体设置为最大化 panel1.Size = this.Size; panel2.Visible = false; } }