上善若水

水善利万物而不争
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

修复 winform窗体无边框最大化后遮挡任务栏

Posted on 2023-06-15 20:44  董锡振  阅读(267)  评论(0编辑  收藏  举报

1、设置窗体的最大尺寸MaxinumSize属性:
this.MaxinumSize = new System.Drawing.Size(
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height)

2、设置窗体最大化的尺寸MaximizedBounds 属性:
this.MaximizedBounds = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea