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

下面综合整理下网上两位博主的用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. http请求(get 和 post 请求)与响应

    版权声明:欢迎转载 https://blog.csdn.net/chenmoquan/article/details/36656101 一.http请求 http请求基本格式 ============ ...

  2. Ext部署在本地tomcat下运行例子

    我本地用的ext6+,从官网下载好Ext后解压到D盘,然后打开tomcat的server.xml,在Host标签内配置 <Context path="/ext-6.2.0" ...

  3. Spring MVC 通过反射将数据导出到excel

    直接上代码 // 导出excel方法 @RequestMapping("exportExcel") public void exportExcel(HttpServletReque ...

  4. Oracle数据库体系结构(1)整体概述

    oracle数据库的存储结构: 逻辑存储结构:oracle内部的组织和管理数据的方式 物理存储结构:oracle外部(操作系统)组织和管理数据的方式 oracle对逻辑存储结构和物理存储结构的管理是分 ...

  5. mysql设置有外键的主键自增及其他

    有外键的主键设置自增. ; ALTER TABLE `<table>` MODIFY COLUMN `id` ) NOT NULL AUTO_INCREMENT FIRST; 创建数据库, ...

  6. neutron qos Quality of Service

    Quality of Service advanced service is designed as a service plugin. The service is decoupled from t ...

  7. 英语发音规则---ai字母组合发音

    英语发音规则---ai字母组合发音 一.总结 一句话总结:字母组合ai在音词中一般发字母a的音/eɪ/,通常出现在闭音节中.这里要注意的是单词中air字母组合与ai字母组合发音的区别,air发/eə/ ...

  8. Delphi - 数组和结构体

    技术交流,DH讲解. 记得很早之前我就说过,数组和结构体在内存中其实一样的,他们都是连续分布的.例如: ? 1 2 3 4 TMyStruct = record   A,B,C:Integer; en ...

  9. 分享知识-快乐自己:FastDFS 上传 java 源码

    FastDFS 上传 java 源码:点我下载源码 首先导入 POM 文件:解决 maven 不能下载 fastdfs-client-java JAR <dependency> <g ...

  10. Memcached 分布式缓存实现原理简介

    摘要 在高并发环境下,大量的读.写请求涌向数据库,此时磁盘IO将成为瓶颈,从而导致过高的响应延迟,因此缓存应运而生.无论是单机缓存还是分布式缓存都有其适应场景和优缺点,当今存在的缓存产品也是数不胜数, ...