欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

WinForm實(shí)現(xiàn)同時(shí)讓兩個(gè)窗體有激活效果的特效實(shí)例

 更新時(shí)間:2014年09月25日 10:36:44   投稿:shichen2014  
這篇文章主要介紹了WinForm實(shí)現(xiàn)同時(shí)讓兩個(gè)窗體有激活效果的特效實(shí)例,基于windows api實(shí)現(xiàn)一個(gè)窗體激活的時(shí)候給另外一個(gè)發(fā)消息的特效,在進(jìn)行C#項(xiàng)目開(kāi)發(fā)時(shí)有一定的實(shí)用價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了WinForm實(shí)現(xiàn)同時(shí)讓兩個(gè)窗體有激活效果的特效。主要采用windows api實(shí)現(xiàn)一個(gè)窗體激活的時(shí)候給另外一個(gè)發(fā)消息。分享給大家供大家參考。

具體實(shí)現(xiàn)方法如下:

using System; 
using System.Windows.Forms; 
using System.Runtime.InteropServices; 
namespace WindowsApplication43 
{ 
  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); 
    } 
  } 
}

希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論