c# – 删除边框winforms和WindowState在没有全屏的情况下最大化
发布时间:2020-12-15 08:08:51 所属栏目:百科 来源:网络整理
导读:我有以下麻烦,我找不到解决方案. 我想实现一个没有顶栏的Winform,如果可能的话,没有边框.我尝试了几件事但没有成功,以下内容可以完美地完成: this.Text = string.Empty; this.ControlBox = false; this.FormBorderStyle = FormBorderStyle.SizableToolWindo
我有以下麻烦,我找不到解决方案.
我想实现一个没有顶栏的Winform,如果可能的话,没有边框.我尝试了几件事但没有成功,以下内容可以完美地完成: this.Text = string.Empty; this.ControlBox = false; this.FormBorderStyle = FormBorderStyle.SizableToolWindow; 产生以下结果: 小问题是当我或用户触发最大化状态时,因为将使表单进入FULLSCREEN模式!我不知道如何防止这种情况: 看到?你看不到windows任务栏!我正在使用 WindowState = FormWindowState.Maximized; // Makes a fullscreen that i dont want ! 感谢您的帮助 ! 解决方法
试试这个动态设置大小,它可能会帮助你.
不要使用WindowState = FormWindowState.Maximized; var rectangle = ScreenRectangle(); Size = new Size(rectangle.Width - 100,rectangle.Height - 100); Location = new Point(50,50); // here 100 is pixel used to reserve from edges,// you can set lower value according to your requirements 完整尺寸 var rectangle = ScreenRectangle(); Size = new Size(rectangle.Width,rectangle.Height); Location = new Point(0,0); 屏幕矩形方法是: public Rectangle ScreenRectangle() { return Screen.FromControl(this).Bounds; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |