Esempio n. 1
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);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Retrun TRUE if Visual Styles for the application are active.
 /// </summary>
 /// <returns></returns>
 public static bool IsXPStylesActive()
 {
     return(isWinXPOrNewer() && NativeWindowCommon.IsThemeActive());
 }