/// <include file='doc\ScrollableControlDesigner.uex' path='docs/doc[@for="ScrollableControlDesigner.WndProc"]/*' />
        /// <devdoc>
        ///     We override our base class's WndProc to monitor certain messages.
        /// </devdoc>
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            switch (m.Msg)
            {
            case NativeMethods.WM_HSCROLL:
            case NativeMethods.WM_VSCROLL:

                // When we scroll, we reposition a control without causing a
                // property change event.  Therefore, we must tell the
                // selection UI service to sync itself.
                //
                if (selectionUISvc == null)
                {
                    selectionUISvc = (ISelectionUIService)GetService(typeof(ISelectionUIService));
                }

                if (selectionUISvc != null)
                {
                    selectionUISvc.SyncSelection();
                }

                // Now we must paint our adornments, since the scroll does not
                // trigger a paint event
                //
                Control.Invalidate();
                Control.Update();
                break;
            }
        }
Пример #2
0
        void SyncDesignerUI()
        {
            Size selectionSize      = new Size(0, 0);
            ISelectionUIService uis = (ISelectionUIService)designerSite.GetService(typeof(ISelectionUIService));

            if (uis != null)
            {
                selectionSize = uis.GetAdornmentDimensions(AdornmentType.Maximum);
            }

            designerRegion.AutoScrollMargin = selectionSize;
            designer.Location = new Point(selectionSize.Width, selectionSize.Height);

            if (uis != null)
            {
                uis.SyncSelection();
            }
        }
Пример #3
0
        /// <include file='doc\FormDocumentDesigner.uex' path='docs/doc[@for="FormDocumentDesigner.OnLoadComplete"]/*' />
        /// <devdoc>
        ///      Called when our code loads.  Here we connect us as the selection
        ///      UI handler for ourselves.  This is a special case because for
        ///      the top level document, we are our own selection UI handler.
        /// </devdoc>
        private void OnLoadComplete(object source, EventArgs evevent)
        {
            ApplyAutoScaling(autoScaleBaseSize, (Form)Control);
            ISelectionUIService svc = (ISelectionUIService)GetService(typeof(ISelectionUIService));

            if (svc != null)
            {
                svc.SyncSelection();
            }

            // if there is a menu and we need to update our height because of it,
            // do it now.
            //
            if (heightDelta != 0)
            {
                ((Form)Control).Height += heightDelta;
                heightDelta             = 0;
            }
        }
Пример #4
0
            /// <include file='doc\DesignerFrame.uex' path='docs/doc[@for="DesignerFrame.OverlayControl.OnCreateControl"]/*' />
            /// <devdoc>
            ///     At handle creation time we request the designer's handle and
            ///     parent it.
            /// </devdoc>
            protected override void OnCreateControl()
            {
                base.OnCreateControl();

                // Loop through all of the overlays, create them, and hook them up
                //
                if (overlayList != null)
                {
                    foreach (Control c in overlayList)
                    {
                        ParentOverlay(c);
                    }
                }

                // We've reparented everything, which means that our selection UI is probably
                // out of sync.  Ask it to sync.
                //
                ISelectionUIService selUISvc = (ISelectionUIService)provider.GetService(typeof(ISelectionUIService));

                if (selUISvc != null)
                {
                    selUISvc.SyncSelection();
                }
            }