private const int WM_ACTIVATEAPP = 0x001C; protected override void WndProc(ref Message m) { // Listen for operating system messages. switch (m.Msg) { // The WM_ACTIVATEAPP message occurs when the application // becomes the active application or becomes inactive. case WM_ACTIVATEAPP: Reload(); // Invalidate to get new text painted. this.Invalidate(); break; } base.WndProc(ref m); } private void Reload() { MessageBox.Show(""); }
然后在B窗体接收该消息,然后在B窗体代码中进行刷新。
protected override void WndProc(ref Message m) {
// Listen for operating system messages.
switch (m.Msg)
{
// The WM_ACTIVATEAPP message occurs when the application
// becomes the active application or becomes inactive.
case WM_ACTIVATEAPP:
Reload(); // Invalidate to get new text painted.
this.Invalidate(); break;
}
base.WndProc(ref m);
} private void Reload() {
MessageBox.Show("");
}