Exemplo n.º 1
0
        /// <devdoc>

        ///     Handles the WM_WINDOWPOSCHANGING message

        /// </devdoc>

        /// <internalonly>

        private void WmWindowPosChanging(ref Message m)
        {
            NativeWindowCommon.WINDOWPOS wp = (NativeWindowCommon.WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(NativeWindowCommon.WINDOWPOS));
            bool updateSize = inAutoscale;

            if (!updateSize)
            {
                IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
                if (host != null)
                {
                    updateSize = host.Loading;
                }
            }


            // we want to update the size if we have a menu and...

            // 1) we're doing an autoscale

            // 2) we're loading a form without an inherited menu (inherited forms will already have the right size)

            //

            if (updateSize && Menu != null && (wp.flags & NativeWindowCommon.SWP_NOSIZE) == 0 && (IsMenuInherited || inAutoscale))
            {
                heightDelta = GetMenuHeight();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// window reposition
        /// </summary>
        /// <param name="m"></param>
        private void WindowReposition(Message m)
        {
            RepositionEventArgs repositionEventArgs = new RepositionEventArgs();

            if (CanReposition != null)
            {
                NativeWindowCommon.WINDOWPOS wp = new NativeWindowCommon.WINDOWPOS();
                wp = (NativeWindowCommon.WINDOWPOS)m.GetLParam(typeof(NativeWindowCommon.WINDOWPOS));

                repositionEventArgs.HwndInsertAfter = wp.hwndInsertAfter;

                CanReposition(this, repositionEventArgs);

                if (!repositionEventArgs.CanReposition)
                {
                    wp.flags |= NativeWindowCommon.SWP_NOZORDER;
                    Marshal.StructureToPtr(wp, m.LParam, true);
                }
            }
        }