[转]C# WinForm 关于窗体最大化时的是否全屏效果与是否遮盖任务栏

0.新建窗体 及添加按钮

1.ITPUB个人空间s6d:vU0UL
  执行如下按钮事件ITPUB个人空间zA\ I;^+M,g"pr Q0J
  private void btnFormMax_Click(object sender, EventArgs e)
+tbh5?'e0  {ITPUB个人空间&MK4ozc;FP
     if (this.WindowState == FormWindowState.Maximized)
b x?p#p,H8t0     {ITPUB个人空间2LM.[3]M
         this.WindowState = FormWindowState.Normal;
.b�ev~q[-@!O0     }
r(Iem4{#bg0     elseITPUB个人空间k$lV&Rohu
     {ITPUB个人空间W8^wm|�qy @
         this.WindowState = FormWindowState.Maximized;ITPUB个人空间^0vQ9h ^
     }ITPUB个人空间x:h;f'Au9P9ZO _
  }ITPUB个人空间J,p/X/F9or
  窗体最大化时 非全屏 不会遮盖任务栏
q@/xc^v6[Px0  此时this.FormBorderStyle. 默认为 Sizable

2.ITPUB个人空间3U&u9])_0dn*c
  执行如下按钮事件ITPUB个人空间[#U%tsT:N%|
  private void btnFormMax_Click(object sender, EventArgs e)ITPUB个人空间:\,l!x-j(_"Qw
  {
NNYi C0^FV$L n�_lY0      if (this.WindowState == FormWindowState.Maximized)
|GQ2p7}O!pT0      {       
%m ]5|vlF0         this.WindowState = FormWindowState.Normal;
O*L^*M$l4Md�Jf(zx0      }ITPUB个人空间\ h'H ~;~
      else
7elW$Ii0      {
| B}@+V}1n qAC0         this.FormBorderStyle. = FormBorderStyle.None;
\/g0o&KB t0w0         this.WindowState = FormWindowState.Maximized;
EcN%WQ�l}B0      }
\+YN0LC0   }

  窗体最大化时 会全屏 及遮盖任务栏
6F0S+N M7[0  此时this.FormBorderStyle. 为 None 不会显示窗体标题栏等相关

3.
KAK Y0HmN F0  执行如下按钮事件
~3E o3NTp0  private void btnFormMax_Click(object sender, EventArgs e)
1nU|5\8A O?-~H0  {ITPUB个人空间}"F#M#X1k0c�X
      if (this.WindowState == FormWindowState.Maximized)ITPUB个人空间,B'BC;bzE*a c�xZ
      {       ITPUB个人空间iGj]g+Y%L+IE
         this.WindowState = FormWindowState.Normal;
5b%t+l.X @(zl/e0      }ITPUB个人空间/w C ZcW g
      elseITPUB个人空间?m{!SrPy7p
      {ITPUB个人空间Qt ^f\
         this.FormBorderStyle. = FormBorderStyle.None;
;pCy*cy'p Z)g0         this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);ITPUB个人空间\Qh9q cn-oc
         this.WindowState = FormWindowState.Maximized;
v1y,c8Rw0      }ITPUB个人空间7y6LOQ&mhHK�s#Y
   }

  窗体最大化时 非全屏 不会遮盖任务栏
/E+G QKc5fIy]0  此时this.FormBorderStyle. 为 None 不会显示窗体标题栏等相关


转载自:
http://space.itpub.net/12639172/viewspace-501587
posted @ 2009-08-12 15:52  泡菜肉丝  阅读(1085)  评论(0编辑  收藏  举报