コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gr"></param>
        /// <param name="rect"></param>
        /// <param name="o"></param>
        /// <param name="state"></param>
        protected override void DrawThumb(Graphics gr, Rectangle rect, Orientation o, ElementState state)
        {
            if (ThemeFactory.VisualStylesEnabled && ThemeFactory.VisualStylesSupported)
            {
                ThemeFactory.DrawScrollBar(gr, rect, ElementStateToScrollBarStates(state),
                                           o == Orientation.Horizontal ? ScrollBarParts.ThumbBtnHorz : ScrollBarParts.ThumbBtnVert);

                if (FirstCoord((Point)rect.Size) > 17)
                {
                    ThemeFactory.DrawScrollBar(gr, rect, ElementStateToScrollBarStates(state),
                                               o == Orientation.Horizontal ? ScrollBarParts.GripperHorz : ScrollBarParts.GripperVert);
                }
            }
            else
            {
                if (state == ElementState.Pushed)
                {
                    ControlPaint.DrawButton(gr, rect, ButtonState.Pushed);
                }
                else
                {
                    ControlPaint.DrawButton(gr, rect, ButtonState.Normal);
                }
            }
        }
コード例 #2
0
ファイル: ThemeFactory.cs プロジェクト: 15831944/Test3-1
        /// <summary>
        ///
        /// </summary>
        /// <param name="g"></param>
        /// <param name="sbRect"></param>
        /// <param name="clipRect"></param>
        /// <param name="state"></param>
        /// <param name="part"></param>
        public static void DrawScrollBar(Graphics g, Rectangle sbRect, Rectangle clipRect,
                                         ScrollBarStates state, ScrollBarParts part)
        {
            if (g == null || sbRect.Width <= 0 || sbRect.Height <= 0 ||
                clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            ThemeFactory.DrawThemeBackground(g, "SCROLLBAR", (int)part, (int)state, sbRect, clipRect);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gr"></param>
        /// <param name="rect"></param>
        /// <param name="d"></param>
        /// <param name="state"></param>
        protected override void DrawArrow(Graphics gr, Rectangle rect, Direction d, ElementState state)
        {
            if (ThemeFactory.VisualStylesEnabled && ThemeFactory.VisualStylesSupported)
            {
                ThemeFactory.DrawScrollBar(gr, rect, GetArrowScrollBarStates(d, state), ScrollBarParts.ArrowBtn);
            }
            else
            {
                ScrollButton sb = DirectionToScrollButton(d);
                ButtonState  bs = ElementStateToButtonState(state);

                ControlPaint.DrawScrollButton(gr, rect, sb, bs);
            }
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gr"></param>
        /// <param name="rect"></param>
        /// <param name="d"></param>
        /// <param name="state"></param>
        protected override void DrawInside(Graphics gr, Rectangle rect, Direction d, ElementState state)
        {
            if (ThemeFactory.VisualStylesEnabled && ThemeFactory.VisualStylesSupported)
            {
                ScrollBarParts p = ScrollBarParts.UpperTrackVert;

                switch (d)
                {
                case Direction.Up:
                    p = ScrollBarParts.UpperTrackVert;
                    break;

                case Direction.Down:
                    p = ScrollBarParts.LowerTrackVert;
                    break;

                case Direction.Left:
                    p = ScrollBarParts.UpperTrackHorz;
                    break;

                case Direction.Right:
                    p = ScrollBarParts.LowerTrackHorz;
                    break;
                }

                ThemeFactory.DrawScrollBar(gr, rect, ElementStateToScrollBarStates(state), p);
            }
            else
            {
                HatchBrush br = new HatchBrush(HatchStyle.Percent50, SystemColors.ScrollBar, Color.White);
                gr.FillRectangle(br, rect);

                br.Dispose();
                br = null;
            }
        }
コード例 #5
0
ファイル: ThemeFactory.cs プロジェクト: 15831944/Test3-1
 /// <summary>
 ///
 /// </summary>
 /// <param name="g"></param>
 /// <param name="sbRect"></param>
 /// <param name="state"></param>
 /// <param name="part"></param>
 public static void DrawScrollBar(Graphics g, Rectangle sbRect,
                                  ScrollBarStates state, ScrollBarParts part)
 {
     ThemeFactory.DrawScrollBar(g, sbRect, sbRect, state, part);
 }
コード例 #6
0
ファイル: ThemeFactory.cs プロジェクト: 15831944/Test3-1
 /// <summary>
 /// Draws the background image defined by the visual style for the specified control part
 /// </summary>
 /// <param name="g">The Graphics to draw on</param>
 /// <param name="windowClass">The class of the part to draw</param>
 /// <param name="part">The part to draw</param>
 /// <param name="partState">The state of the part to draw</param>
 /// <param name="drawRect">The Rectangle in which the part is drawn</param>
 public static void DrawThemeBackground(Graphics g, string windowClass, int part, int partState, Rectangle drawRect)
 {
     ThemeFactory.DrawThemeBackground(g, windowClass, part, partState, drawRect, drawRect);
 }