【问题标题】:Compact Framework - Keep modal window in front of windows bar after closing CaptureCameraDialogCompact Framework - 关闭 CaptureCameraDialog 后将模式窗口保留在窗口栏前面
【发布时间】:2011-04-19 18:16:23
【问题描述】:

我正在开发一个 Windows 移动应用程序。我创建了一个使用模式窗口的向导,以便隐藏窗口栏。其中一个向导阶段需要拍照。启动 CaptureCameraDialog 后,即使在 CaptureCameraDialog 关闭后,窗口栏也会出现并保留。有什么办法可以让我的对话框回到窗口栏的前面?

【问题讨论】:

    标签: compact-framework


    【解决方案1】:

    我最终设法在网络上找到了一些符合我要求的代码。这里是:

    public partial class myForm : Form
    {
    public myForm()
    {
       InitializeComponent();
            this.GotFocus += delegate(object sender, EventArgs args)
                                 {
                                     //var intPtr = FindWindow("CaptureReturnForm", "");
                                     SetForegroundWindow(GetFocus());
                                     bool result = SHFullScreen(GetFocus(), SHFS_HIDESTARTICON |
                                     SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON); // 0x0020);
    
                                 };
    
    
        }
    
        [DllImport("coredll.dll")]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
        [DllImport("coredll.dll", EntryPoint = "SetForegroundWindow")]
        private static extern int SetForegroundWindow(IntPtr hWnd);
        [DllImport("coredll.dll")]
        internal static extern IntPtr GetFocus();
        [DllImport("aygshell.dll")]
        internal static extern bool SHFullScreen(IntPtr hWnd, uint dwState);
    
        const uint SHFS_SHOWTASKBAR = 0x1;
        const uint SHFS_HIDETASKBAR = 0x2;
        const uint SHFS_SHOWSIPBUTTON = 0x4;
        const uint SHFS_HIDESIPBUTTON = 0x8;
        const uint SHFS_SHOWSTARTICON = 0x10;
        const uint SHFS_HIDESTARTICON = 0x20;
        const int HWND_TOPMOST = -1;
        const int HWND_NOTOPMOST = -2;
    
        const uint SWP_SHOWWINDOW = 0x40;
        const uint SM_CXSCREEN = 0x0;
        const uint SM_CYSCREEN = 0x1;
        private const int HHTASKBARHEIGHT = 26;
    }
    

    【讨论】:

      猜你喜欢
      • 2014-05-03
      • 2018-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多