Exemplo n.º 1
0
        /// <include file="doc\FormDocumentDesigner.uex" path='docs/doc[@for="FormDocumentDesigner.OnDesignerDeactivate"]/*'>

        /// <devdoc>

        ///     Called by the host when we become inactive.  Here we update the

        ///     title bar of our form so it's the inactive color.

        /// </devdoc>

        private void OnDesignerDeactivate(object sender, EventArgs e)
        {
            Control control = Control;

            if (control != null && control.IsHandleCreated)
            {
                NativeWindowCommon.SendMessage(control.Handle, NativeWindowCommon.WM_NCACTIVATE, 0, 0);

                NativeWindowCommon.RedrawWindow(control.Handle, IntPtr.Zero, IntPtr.Zero, NativeWindowCommon.RedrawWindowFlags.RDW_FRAME);
            }
        }
Exemplo n.º 2
0
        // <doc>

        // <desc>

        //      Called when our document becomes active.  We paint our form's

        //      border the appropriate color here.

        // </desc>

        // </doc>

        //

        private void OnDesignerActivate(object source, EventArgs evevent)
        {
            // Paint the form's title bar UI-active

            //

            Control control = Control;



            if (control != null && control.IsHandleCreated)
            {
                NativeWindowCommon.SendMessage(control.Handle, NativeWindowCommon.WM_NCACTIVATE, 1, 0);

                NativeWindowCommon.RedrawWindow(control.Handle, IntPtr.Zero, IntPtr.Zero, NativeWindowCommon.RedrawWindowFlags.RDW_FRAME);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// this causes paint for the table scrollbar area after scrollbar disappear while using Windows Themes
        /// </summary>
        protected void HideVerticalScrollbarAnimationForWindowsThemes()
        {
            if (NativeWindowCommon.IsThemeActive())
            {
                NativeScroll.SCROLLINFO sc  = ScrollInfo(NativeScroll.SB_VERT); //force table to stop dragging when we hide scrollbar
                ScrollEventArgs         arg = new ScrollEventArgs(ScrollEventType.EndScroll, sc.nPos, sc.nPos, ScrollOrientation.VerticalScroll);
                this.OnScroll(arg);

                SuspendLayout();
                sc.nPos = 0;
                sc.nMin = 0;
                //For some reason, we need the following code
                // a. While dragging thumb: As in case of Defect #115454. After the scrollbar is displayed, try dragging the thumbbar upwards.
                //    It remains visible even after the scrollbar is hidden. The problem is fixed if nMax and nPage are set to 0.
                // b. While clicking on the scrollbar just above the thumb so that scroll will be hidden (as in case of defect #115331, RIA task)
                //    After hiding vertical scrollbar if column width is increased to display horizontal scrollbar and then the thumb on horizontal
                //    scroll bar is clicked, some area above horizontal scroll bar is grayed. The problem is fixed if nMax and nPage are set to 1.
                if (_isThumbDrag)
                {
                    sc.nMax = sc.nPage = 0;
                }
                else
                {
                    sc.nMax = sc.nPage = 1;
                }
                sc.fMask = NativeScroll.SIF_ALL;
                NativeScroll.SetScrollInfo(this.Handle, NativeScroll.SB_VERT, ref sc, true);

                NativeScroll.ShowScrollBar(this.Handle, NativeScroll.SB_VERT, false);

                isVerticalScrollBarVisible = false;
                ResumeLayout();
                NativeWindowCommon.RedrawWindow(this.Handle, IntPtr.Zero, IntPtr.Zero, NativeWindowCommon.RedrawWindowFlags.RDW_FRAME |
                                                NativeWindowCommon.RedrawWindowFlags.RDW_INVALIDATE);
                this._header.Refresh();
            }
            else
            {
                NativeScroll.ShowScrollBar(this.Handle, NativeScroll.SB_VERT, false);
            }
        }