Chinaunix首页 | 论坛 | 博客
  • 博客访问: 743861
  • 博文数量: 769
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 4985
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-15 16:37
文章分类

全部博文(769)

文章存档

2011年(1)

2008年(768)

我的朋友

分类:

2008-10-15 16:37:40

        using System;
        using System..Forms;
        using System.Runtime.InteropServices;
        namespace Application43
        {
            public partial class Form1 : Form
            {
                Form frm =null;
                public Form1()
                {
                    InitializeComponent();
                    this.Activated += Form_Activated;
                }
                const int WM_NCACTIVATE = 0x86;
                const int WA_ACTIVE = 0x1;
                [DllImport("user32.dll", EntryPoint = "SendMessage")]
                public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
                private void button1_Click(object sender, EventArgs e)
                {
                    frm = new Form();
                    frm.Text = "jinjazz";
                    frm.Activated += Form_Activated;
                    frm.Show();
                    frm.Location = new System.Drawing.Point(this.Left + this.Width, this.Top);
                    SendMessage(this.Handle, WM_NCACTIVATE, WA_ACTIVE, 0);
                }
                void Form_Activated(object sender, EventArgs e)
                {
                    SendMessage(this.Handle, WM_NCACTIVATE, WA_ACTIVE, 0);
                    if (frm != null)
                        SendMessage(frm.Handle, WM_NCACTIVATE, WA_ACTIVE, 0);
                }
            }
        }


--------------------next---------------------

阅读(826) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~