Windows mobile多窗口的模式中窗口之间切换显示的连续性

来源:互联网 发布:网络平台贷款是否合法 编辑:程序博客网 时间:2024/04/30 15:50
 

代码如下:主要就是利用SetForegroundWindow

[DllImport("coredll.dll", EntryPoint = "GetCapture")]
private static extern IntPtr GetCapture();

[DllImport("coredll.dll", EntryPoint = "SetForegroundWindow")]
private static extern bool SetForegroundWindow(IntPtr hwnd);

public  bool SetFormTop(Form form)
 {
           form.Capture = true;
           IntPtr hwnd = GetCapture();
           form.Capture = false;

           return SetForegroundWindow(hwnd);
}

 private void bt_Click(object sender, EventArgs e)
{
            Form1 fdlg = new Form1();
            string title = this.Text;
            this.Text = string.Empty;//隐藏窗口标题

            fdlg .ShowDialog();   

            this.Text = title;

            SetFormTop(this);//在上个Form窗口返回的时候,把自己设置到最上面显示
  }

如果是在Smartphone中,那么结合上次说的对Back Key健的响应处理就更完美了.

原创粉丝点击