用常规方法实现全屏显示时,由于采用的三方控件导致界面顶端一直有一条半透明的类似标题栏的东西无法去除,原因一直没找到。

下面综合整理下网上两位博主的用WindowsAPI实现全屏的方法:

控件全屏显示: http://www.cnblogs.com/lmcblog/archive/2012/07/14/2591501.html

任务栏、开始菜单栏显示隐藏:http://www.cnblogs.com/ITBread/p/3503801.html

我把代码整理下,方便下次自己查看

1、任务栏、菜单栏的显示与隐藏

 [DllImport("user32.dll")]
public static extern bool GetCursorPos(ref Point lpPoint); [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]
public static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow); public static Point GetCursorPos()
{
Point point = new Point();
GetCursorPos(ref point);
return point;
} public static void HideTask(bool isHide)
{
try
{
IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
IntPtr hStar = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Button", null); if (isHide)
{
ShowWindow(trayHwnd, );
ShowWindow(hStar, );
}
else
{
ShowWindow(trayHwnd, );
ShowWindow(hStar, );
}
}
catch { }
}

2、控件的全屏与取消

{
WindowFullScreenApi.HideTask(true);//先隐藏工具栏
var axTeWnd = axTe3DWindow;
axTeWnd.Dock = DockStyle.None;
axTeWnd.Left = ;
axTeWnd.Top = ;
axTeWnd.Width = Screen.PrimaryScreen.Bounds.Width;//获取显示器大小
axTeWnd.Height = Screen.PrimaryScreen.Bounds.Height;
WindowFullScreenApi.SetParent(axTeWnd.Handle, IntPtr.Zero); axTe3DWindow.Focus(); //axTeDWindow是我需要全屏的窗体控件
Application3D.CurrentSystemState.onKeyboardMessage = OnKeyDown;
} //按下Wsc键取消全屏
private void OnKeyDown(object sender, _ITE3DWindowEvents_OnKeyboardMessageEvent e)
{
if (e.keyCode == )
{
//SenceContrl.NormalForm();
WindowFullScreenApi.SetParent(axTe3DWindow.Handle, axTe3DWindow.Parent.Handle);
axTe3DWindow.OnKeyboardMessage -= OnKeyDown;
axTe3DWindow.Dock = DockStyle.Fill;
WindowFullScreenApi.HideTask(false);
}
}

winfrom实现控件全屏效果的更多相关文章

  1. C# WinForm中 让控件全屏显示的实现代码

    夏荣全 ( lyout(at)163.com )原文 C#中让控件全屏显示的实现代码(WinForm) 有时候需要让窗口中某一块的内容全屏显示,比如视频播放.地图等等.经过摸索,暂时发现两种可行方法, ...

  2. Extjs 疑难杂症 (LoadMark 遮罩、Panel Update无效、chrome浏览器date控件全屏)

    一.在extjs gridPanel中使用LoadMark无效,三步搞定. 原代码: grid = new Ext.grid.GridPanel({ store: store, title:'资料列表 ...

  3. Qt 之容器内的控件全屏

    m_label = new QLabel(); ui->stackedWidget->addWidget(m_label); ui->stackedWidget->setCur ...

  4. jQuery制作Web全屏效果

    需要的资源 1.jQuery版本库是必不可少的2.jQuery FullScreen plugin如果你下载不方便的话,你可以直接把下面的代码copy到你本地JQuery FullScreen plu ...

  5. Android学习之Android 5.0分享动画实现微信点击全屏效果

    Android5.0过渡动画,请看 http://blog.csdn.net/qq_16131393/article/details/51112772 今天用分享动画实现微信点击全屏效果 本文源代码下 ...

  6. js 实现浏览器全屏效果

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. axTE3DWindowEx双屏对比控件白屏解决方法以及网上方法的校正(CreateControlOveride)

    环境:vs2012,TE 6.5.1,winfrom C# 要做skyline的双屏显示功能,网上找到方法是用axTE3DWindowEx控件实现,把控件拖进去,运行,发现axTE3DWindow是正 ...

  8. 使控件具有 Tilt 效果

    步骤1:添加类: /* Copyright (c) 2010 Microsoft Corporation. All rights reserved. Use of this sample source ...

  9. Android -- 常见控件的小效果

    1,EditText控件 ① 修改光标颜色 自定义drawable 创建cursor.xml文件 <?xml version="1.0" encoding="utf ...

随机推荐

  1. 关于highcharts-ng

    1.内容都正确但是不显示,使用parseInt()方法转换

  2. easy_install和pip的安装及使用

    在终端输入命令报错后,在网上找到了这篇博客,用easy_install命令安装pip,问题解决 Fatal error in launcher: Unable to create process us ...

  3. ubuntu 16.04 jenkins pipline的实现 最终docker启动服务

    准备工作:两台虚拟机A:192.168.1.60 B:192.168.1.61 C:一个存放代码的代码库(github)A:jenkins git docker openssh-server(ssh) ...

  4. poj 1028 Web Navigation 【模拟题】

    题目地址:http://poj.org/problem?id=1028 测试样例: Sample Input VISIT http://acm.ashland.edu/ VISIT http://ac ...

  5. poj 3278 Catch That Cow-搜索进阶-暑假集训

    Catch That Cow Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Subm ...

  6. SpringBoot2.0之整合RabbitMQ

    案例: Springboot 对RabbitMQ的支持 公共的pom: <project xmlns="http://maven.apache.org/POM/4.0.0" ...

  7. 学习docker可能会用到的参考

    局域网部署Docker--从无到有创建自己的Docker私有仓库 http://lib.csdn.net/base/docker 正在刷(学习)一遍官方文档,上面是一些其他可能用到的资料,是在解决自己 ...

  8. hdu 4542 小明系列故事——未知剩余系 反素数 + 打表

    小明系列故事——未知剩余系 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Prob ...

  9. jquery侧边折叠导航栏制作,两行代码搞定

    jquery侧边折叠导航栏制作,两行代码搞定 //CSS*{margin: 0;padding: 0} ul{list-style: none} .menu li ul{display: none} ...

  10. Codeforces 876C Classroom Watch:枚举

    题目链接:http://codeforces.com/contest/876/problem/C 题意: 定义函数:f(x) = x + 十进制下x各位上的数字之和 给你f(x)的值(f(x) < ...