MessageBox Center Solution relative to Div layer
public void Wndprocret (object sender, Wndprocreteventargs e)
{
Switch (e.cw.message)
{
Case Wndmessage.wm_initdialog:
Case Wndmessage.wm_unknowinit:
User32.movewindow (E.cw.hwnd, Rect.left, Rect.top, Rect.width, Rect.height, 1);
Uninstall this hook
Windowshook Wndhook = (windowshook) sender;
Debug.Assert (Wndprocrethook = = Wndhook);
Wndprocrethook.uninstall ();
Wndprocrethook = null;
Break
Default:break;
}
}
Use the following code after the call
public void Wndprocret (object sender, Wndprocreteventargs e)
{
Switch (e.cw.message)
{
Case Wndmessage.wm_initdialog:
Case Wndmessage.wm_unknowinit:
Case Wndmessage.wm_activate://tony 2011.3.12 Update This is the key that can be displayed in the center of the current parent form!
User32.movewindow (E.cw.hwnd, Rect.left, Rect.top, Rect.width, Rect.height, 1);
Uninstall this hook
Windowshook Wndhook = (windowshook) sender;
Debug.Assert (Wndprocrethook = = Wndhook);
Wndprocrethook.uninstall ();
Wndprocrethook = null;
Break
Default:break;
}
}