The examples in this article describe the effects that WinForm implements to make two forms active at the same time. The main use of Windows API implementation of a form when the activation of a message to send another. Share to everyone for your reference.
The implementation method is as follows:
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 w Param, 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); } }}
I hope this article is helpful to everyone's C # programming.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
WinForm implements an instance of the effect of having two forms active simultaneously
This address: http://www.paobuke.com/develop/c-develop/pbk23467.html
Related content WinForm example of how to extract content using regular expressions C # 3 kinds of Effects C # format string implementation code c#êμ?? 3ìdò?a?ú??? ˉμ?? ¨
The timer in C # and its garbage collection mechanism C # implements voice video recording-with demo source C # Implements a method of disrupting the order of elements in an array C # methods for parsing JSON into datetable
WinForm implements an instance of the effect of having two forms active simultaneously