码迷,mamicode.com
首页 > Windows程序 > 详细

winform窗体程序最大化时遮挡屏幕任务栏的设置

时间:2018-03-03 12:24:07      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:state   for   导致   笔记本电脑   info   screen   class   程序   通过   

     在程序设计中,我想使用无边框而且最大化。但是这样设置之后,应用程序往往会遮挡屏幕的任务栏。刚开始觉得遮挡任务栏的应用程序挺有意思,用着用着反倒觉得真是反人类啊。所以想着怎么改善这种遮挡任务栏的应用程序:

通过验证:winform窗体的FormBorderstyle设置为none时,会出现遮挡任务栏;

                  winform窗体的controlbox设置为false也是会导致遮挡任务栏;

最后按照网上的, 

    this.FormBorderStyle = FormBorderStyle.None;
         this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
         this.WindowState = FormWindowState.Maximized;

但是发现还是遮挡任务栏,调试发现Screen.PrimaryScreen.WorkingArea.Width的值为1536,Screen.PrimaryScreen.WorkingArea.Height的值为864,遮挡任务栏.而替换为

         this.MaximumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

此时:Screen.PrimaryScreen.Bounds.Width的值依然为1536,Screen.PrimaryScreen.Bounds.Height值为864.依然是遮挡任务栏。

笔记本电脑和台式机都测试了,都是这样,说明这种方法还是行不通。

   最后还是设置

winform窗体的FormBorderstyle设置为FixedSingle, winform窗体的controlbox设置为true,然后再使用DMSkin类似于这样的皮肤控件进行美化。

winform窗体程序最大化时遮挡屏幕任务栏的设置

标签:state   for   导致   笔记本电脑   info   screen   class   程序   通过   

原文地址:https://www.cnblogs.com/cumt-cwp/p/8496059.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!