【www.gdgbn.com--php函数】

messagebox相对于div层居中解决方法

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;
            }

}

 

经过调用使用如下代码

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 这是能否显示在当前父窗体中央的关键!
                    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;
            }
        }

本文来源:http://www.gdgbn.com/jiaocheng/29424/