电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

WinForm特效:同时让两个窗体有激活效果


发布日期:2022/11/10
 

windows api一个窗体激活的时候给另外一个发消息

using System;

using SystemWindowsForms;

using SystemRuntimeInteropServices;

namespace WindowsApplication

{

public partial class Form : Form

{

Form frm =null;

public Form()

{

InitializeComponent();

thisActivated += Form_Activated;

}

const int WM_NCACTIVATE = x;

const int WA_ACTIVE = x;

[DllImport(userdll EntryPoint = SendMessage)]

public static extern int SendMessage(IntPtr hWnd int wMsg int wParam int lParam);

private void button_Click(object sender EventArgs e)

{

frm = new Form();

frmText = jinjazz;

frmActivated += Form_Activated;

frmShow();

frmLocation = new SystemDrawingPoint(thisLeft + thisWidth thisTop);

SendMessage(thisHandle WM_NCACTIVATE WA_ACTIVE );

}

void Form_Activated(object sender EventArgs e)

{

SendMessage(thisHandle WM_NCACTIVATE WA_ACTIVE );

if (frm != null)

SendMessage(frmHandle WM_NCACTIVATE WA_ACTIVE );

}

}

}

上一篇:获取源页的公共属性值

下一篇:使用Override和New关键字进行版本控制