teky 的 blog
在vck中学习,在vck中进步~
<2007年1月>
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910
公告

留言簿(11)

随笔档案

文章分类

文章档案

相册

Windows Mobile

我的好友

朋友创业,其路漫漫

搜索

最新评论

阅读排行榜

评论排行榜

 
VC知识库BLOG   首页  新随笔  联系  聚合  登录 
  随笔-30 文章-17 评论-94 Trackbacks-4
2007年1月26日

代码如下:主要就是利用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健的响应处理就更完美了.

发表于 2007-01-26 17:41 teky 阅读(2607) | 评论 (2)编辑 收藏