VS2003Winform全屏显示问题

Deitel 2011-04-13 12:58:23
如何实现全屏显示,要能把菜单和任务栏覆盖了的。
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
这样的虽然能实现最大化,却覆盖不了任务栏。
而且TopMost属性在winform里不支持。
请各位高手指教,谢谢啦。。
...全文
132 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
showgun680 2011-04-13
  • 打赏
  • 举报
回复
vs2005 三句
this.WindowState = FormWindowState.Normal;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
Deitel 2011-04-13
  • 打赏
  • 举报
回复
还是调用API函数隐藏了任务栏。这样可以实现了。结帖。。
[DllImport("coredll.dll")]
private static extern int FindWindow(string lpClassName, string lpWindowName);

[DllImport("coredll.dll")]
internal extern static int EnableWindow(int hwnd, int fEnable);

[DllImport("coredll.dll")]
public static extern int ShowWindow(int hwnd, int nCmdShow);

private void button1_Click(object sender, System.EventArgs e)
{
int hTaskBarWnd = FindWindow("HHTaskBar", null);
ShowWindow(hTaskBarWnd, 0);
this.Size = new Size(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
}
Deitel 2011-04-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 bloodish 的回复:]
How To Make a Windows Form App Truly Full Screen (and Hide Taskbar) in C#
[/Quote]
这个是针对普通窗体的,CE下的试了下,用不了。。谢谢哈。
Deitel 2011-04-13
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 matrixcl 的回复:]
CE下.net库不一样,支持的方法也不一样了
[/Quote]
是哈,纠结了半天了。真想直接换VS2005或者更高版本了。。
ColinMelody 2011-04-13
  • 打赏
  • 举报
回复
刚才试了一下,this.TopMost = true; 不加也可以。~
ColinMelody 2011-04-13
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 matrixcl 的回复:]
难道是xp和win7的差异,我在win7上加这两行可以全屏
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;


另外this.TopMost = true;可以用啊
[/Quote]

这样应该就可以了。~
matrixcl 2011-04-13
  • 打赏
  • 举报
回复
CE下.net库不一样,支持的方法也不一样了
Deitel 2011-04-13
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 matrixcl 的回复:]
难道是xp和win7的差异,我在win7上加这两行可以全屏
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;


另外this.TopMost = true;可以用啊
[/Quote]
应该不是XP和win7的差别。是VS2003和以后版本的差别。
而且VS2003的topmost属性在正常的窗体中可以使用的。在winform里用不了。

PS:我写的这个程序是在CE4.2下运行的。
matrixcl 2011-04-13
  • 打赏
  • 举报
回复
难道是xp和win7的差异,我在win7上加这两行可以全屏
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;


另外this.TopMost = true;可以用啊
Deitel 2011-04-13
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 matrixcl 的回复:]
楼主,你这两行代码是可以全屏窗口的。
我猜测你的问题在于调用时机不对。
[/Quote]
我试了直接窗体属性设置、load时调用、button调用三种方式
threenewbee 2011-04-13
  • 打赏
  • 举报
回复
this.TopMost = true;
matrixcl 2011-04-13
  • 打赏
  • 举报
回复
楼主,你这两行代码是可以全屏窗口的。
我猜测你的问题在于调用时机不对。
ningweidong 2011-04-13
  • 打赏
  • 举报
回复
窗体的边框设为none,最大化以后就可以盖住任务栏了

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧