在WINCE 6.0 C#应用程序全屏 [英] Fullscreen app in wince 6.0 c#

查看:176
本文介绍了在WINCE 6.0 C#应用程序全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序,并希望把它在全屏模式下,没有任务栏上运行。
我发现了如何隐藏窗栏,但,当我开始我的应用程序它不包括Windows任务栏的空间,尽管最后是隐藏的。

I have my app and want to make it run in full-screen mode, no task-bar. I found out how to hide the windows bar but when I start my app it doesn't cover the space of the windows task-bar, despite this last is hidden.

我发现这,但没有奏效。我找不到关于畏缩这方面的例子。
我的 FormBorderStyle =无 WindowsState =最大化

I found this but it didn't work. I couldn't find examples of this regarding to wince. I have FormBorderStyle = None, and WindowsState = Maximized

解决方案:

我觉得做这件事的方式。一个重要的技巧是有 的WindowState =正常(我花了一些时间来找到这个问题)。如果你的的WindowState =最大化的你可以不设置窗体的高度到最大显示器的高度。

I find a way of doing it. An important tip is to have the WindowState = Normal(it took me some time to find this problem). If you have WindowState = Maximized you can't set the Form's height to the maximum display's height.

我写了这个代码来探测它,它工作正常。是一个有两个按钮的形式:按钮1(全屏)和按钮2(恢复默认屏幕)

I wrote this code to probe it and it work ok. Is a Form with two buttons: button1(fullscreen) and button2(restore default screen)

    public partial class Form1 : Form
    {
        public Form1(){
               InitializeComponent();            
        }

    [DllImport("Coredll")]
    internal static extern IntPtr FindWindow(String lpClassName, String lpWindowName);

    [DllImport("coredll.dll")]
    internal static extern bool EnableWindow(IntPtr hwnd, Boolean bEnable);

    [DllImport("coredll.dll")]
    private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int cx, int cy, bool repaint);


    public static bool EnableTaskBar(Boolean enable)
    {
        IntPtr hwnd;
        hwnd = FindWindow("HHTaskBar", "");

        if (enable) SetHHTaskBar();
        else HideHHTaskBar();

        return EnableWindow(hwnd, enable);
    }

    public static void HideHHTaskBar()
    {
        IntPtr iptrTB = FindWindow("HHTaskBar", null);
        MoveWindow(iptrTB, 0, Screen.PrimaryScreen.Bounds.Height,
        Screen.PrimaryScreen.Bounds.Width, 26, true);
    }

    public static void SetHHTaskBar()
    {
        IntPtr iptrTB = FindWindow("HHTaskBar", null);
        MoveWindow(iptrTB, 0, 294,
        Screen.PrimaryScreen.Bounds.Width, 26, true);
    }


    private void button1_Click(object sender, EventArgs e)
    {
        EnableTaskBar(false);
        this.Width = Screen.PrimaryScreen.Bounds.Width;
        this.Height = Screen.PrimaryScreen.Bounds.Height;
        this.Left = 0;
        this.Top = 0;
    }

    private void button2_Click(object sender, EventArgs e)
    {
        EnableTaskBar(true);
    }
}



希望它可以帮助其他有同样问题!

Hope it helps others with the same problem!

感谢您的帮助!

推荐答案

隐藏任务栏后,明确设置窗体的大小和位置:

After hiding the task bar, explicitly set the size and position of your Form:

myForm.Width = Screen.PrimaryScreen.Bounds.Width;
myForm.Height = Screen.PrimaryScreen.Bounds.Height;
myForm.Left = 0;
myForm.Top = 0;

这篇关于在WINCE 6.0 C#应用程序全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆