• 首页
  • 项目
  • 会员
  • 博客
  • 共享建站
  • 秀我网游
  • BUG反馈

只要钻研不要钱

只要钻研不要钱
不要浪费每一分每一秒,珍惜眼前,怀念过去。

博客分类

  • 心情文章
  • LINUX技术
  • 情情的故事
  • 构思
  • C#技术
  • JAVA技术
  • 其它
  • NHibernate
  • 嵌入式开发
  • 娱乐
  • 项目管理
  • 单片机
  • C语言
  • STM32

最新日志

  • 单网卡 Ubuntu 服务器打造 PPTP Server
  • Ubuntu php 环境配置
  • Ubuntu下Ftp的安装和配置(vsftpd)
  • 为Windows 7 Professional安装多语言包
  • 在 .NET Framework 3.5 中管理目录安全主体
  • 自制ghost光盘如此简单
  • NSIS安装制作基础教程
  • Magic Mouse拆解
  • 美国买的thinkpad在国内保修的方法
  • ActiveX控件打包成Cab置于网页中自动下载安装
  • VB控件实现IObjectSafety安全接口,保证控件自动下载
  • 微软代码签名证书(.pvk/.spc)签名指南
  • 如何為你的 firefox plugin 加上新的 method
  • 如何让Firefox Plugin可以在网页中自动安装
  • mozilla firefox 插件开发 快速入门

PPC winform 程序 如何 全屏(C#)(转)

小字体 中字体 大字体


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;

namespace Hello_World
{
     public partial class StartForm : Form
     {
        private Timer timer;
        public StartForm()
        {

            InitializeComponent();
            IntPtr hWnd = API.FindWindow(this.Text);
            if (hWnd != IntPtr.Zero)
            {
                System.Diagnostics.Debug.WriteLine("hWnd ist nicht null");
                this.MaximizeBox = false;
                this.MinimizeBox = false;
                this.Focus();

                SHAPI.SetForegroundWindow(hWnd);
                SHAPI.FullScreen(hWnd);
            }
       }
    }

   public class API
    {
        [DllImport("coredll.dll", EntryPoint = "FindWindow")]
        private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);

        public static IntPtr FindWindow(string windowName)
        {
            return FindWindow(null, windowName);
        }
    }

    public class SHAPI
    {
        public const int SHFS_SHOWTASKBAR = 1;
        public const int SHFS_HIDETASKBAR = 2;
        public const int SHFS_SHOWSIPBUTTON = 4;
        public const int SHFS_HIDESIPBUTTON = 8;
        public const int SHFS_SHOWSTARTICON = 16;
        public const int SHFS_HIDESTARTICON = 32;

        [DllImport("aygshell.dll")]
        private extern static bool SHFullScreen(IntPtr hWnd, int dwState);

        public static bool FullScreen(IntPtr hWnd)
        {
             return SHFullScreen(hWnd, SHFS_HIDESTARTICON | SHFS_HIDETASKBAR);
        }

        [DllImport("coredll.dll")]
        internal static extern int SetForegroundWindow(IntPtr hWnd);
   }
} 
 

下面的代码仅仅隐藏开始菜单但程序退出后会重现:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;

namespace Wm5ppc
{
   public partial class Form1 : Form
{ public Form1 () { InitializeComponent (); this.MinimizeBox = false; } private void Form1_Activated (object sender, EventArgs e) { IntPtr hWnd = this.Handle; SHAPI.FullScreen (hWnd); } } public class SHAPI
{ public const int SHFS_SHOWTASKBAR = 1; public const int SHFS_HIDETASKBAR = 2; public const int SHFS_SHOWSIPBUTTON = 4; public const int SHFS_HIDESIPBUTTON = 8; public const int SHFS_SHOWSTARTICON = 16; public const int SHFS_HIDESTARTICON = 32;
      [DllImport ("aygshell.dll")]
      private extern static bool SHFullScreen (IntPtr hWnd, int dwState);
      
      public static bool FullScreen (IntPtr hWnd)
      {
         return SHFullScreen (hWnd, SHFS_HIDESTARTICON);
      }
   }
}

以上代码本人经过测试,好像不是很稳定,试过几次是可以全屏的,连开始菜单也没有了,现在一直都没办法全屏,我测试的系统是WINCE5,不知道是不是漏了哪个步骤没做好。

 

回顶部回顶部


日志评论


还没有人评论.
姓名:

内容:

验证码:




  • 首页|
  • 关于我们|
  • 服务|
  • 解决方案|
  • 有话要说|
  • 业务咨询|
  • 在线项目|
  • 登录|
  • 联系我们|

Copyright © wholuck 2009. All Rights Reserved.
粤ICP备09081412号