转载 全螢幕程式,用P/Invoke的方式呼叫SHFullScreen API把左上角的Start圖示隱藏起來收藏

1. 可以用全螢幕程式的寫法,用P/Invoke的方式呼叫SHFullScreen API把左上角的Start圖示隱藏起來,讓使用者沒辦法點擊...

public class SHFullScreenHelper
{
  private const Int32 SHFS_SHOWSTARTICON          = 0x0010;
  private const Int32 SHFS_HIDESTARTICON          = 0x0020;

  private const string formWindowClassName = "#NETCF_AGL_BASE_" ;

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

  [DllImport("coredll.dll")]
  private static extern IntPtr FindWindow(string className, string
windowName) ;

  private static IntPtr GetWindowHandle(Form f)
  {
    return FindWindow(formWindowClassName, f.Text);
  }

  // This is only method we need to call - the other stuff is just helpers
  public static bool ShowStartIcon(Form f, bool bShow)
  {
    Int32 dwFlag = bShow ? SHFS_SHOWSTARTICON : SHFS_HIDESTARTICON ;
    return SHFullScreen(GetWindowHandle(f), dwFlag) != 0;
  }
}
或者是把Form.Window做一些手腳

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

    this.Menu = null;  // 拿掉MainMenu, 但程式叫用inputPanel會有問題
    this.WindowState = FormWindowState.Maximized;  // 設為
Mazimized
  } // ...
}

 

发表于 @ 2006年08月10日 10:18:00|评论(loading...)

新一篇: 获取智能设备唯一编号  | 旧一篇: Pocket PC 2003开发入门数据库操作

Csdn Blog version 3.1a
Copyright © Channels_net