Example #1
0
        protected internal virtual void OnPaintScrollBarArrow(TCEventArgs.PaintScrollBarArrowEventArgs e)
        {
            Graphics       graphics       = e.Graphics;
            Rectangle      arrowRectangle = e.ArrowRectangle;
            ControlState   controlState   = e.ControlState;
            ArrowDirection arrowDirection = e.ArrowDirection;
            Orientation    orientation    = e.Orientation;
            bool           enabled        = e.Enabled;
            Color          backNormal     = this.BackNormal;
            Color          begin          = this.Base;
            Color          border         = this.Border;
            Color          innerBorder    = this.InnerBorder;
            Color          fore           = this.Fore;
            bool           changeColor    = false;

            if (enabled)
            {
                switch (controlState)
                {
                case ControlState.Hover:
                    begin = this.BackHover;
                    goto Label_00BD;

                case ControlState.Pressed:
                    begin       = this.BackPressed;
                    changeColor = true;
                    goto Label_00BD;
                }
                begin = this.Base;
            }
            else
            {
                backNormal = this.GetGray(backNormal);
                begin      = this.GetGray(this.Base);
                border     = this.GetGray(border);
                fore       = this.GetGray(fore);
            }
Label_00BD:
            using (new SmoothingModeGraphics(graphics))
            {
                ControlPaintEx.DrawScrollBarArraw(graphics, arrowRectangle, begin, backNormal, border, innerBorder, fore, e.Orientation, arrowDirection, changeColor);
            }
        }
Example #2
0
        private void DrawScrollBar(IntPtr maskHWnd, Rectangle bounds, Rectangle trackRect, Rectangle topLeftArrowRect, Rectangle bottomRightArrowRect, Rectangle thumbRect, ControlState topLeftArrowState, ControlState bottomRightArrowState, ControlState thumbState, Orientation direction)
        {
            bool            flag    = direction == Orientation.Horizontal;
            bool            enabled = this._owner.Enabled;
            IScrollBarPaint paint   = this._owner as IScrollBarPaint;

            if (paint != null)
            {
                ImageDc dc = new ImageDc(bounds.Width, bounds.Height);
                IntPtr  dC = Win32.NativeMethods.GetDC(maskHWnd);
                try
                {
                    using (Graphics graphics = Graphics.FromHdc(dc.Hdc))
                    {
                        using (TCEventArgs.PaintScrollBarTrackEventArgs args = new TCEventArgs.PaintScrollBarTrackEventArgs(graphics, trackRect, direction, enabled))
                        {
                            paint.OnPaintScrollBarTrack(args);
                        }
                        ArrowDirection arrowDirection = flag ? ArrowDirection.Left : ArrowDirection.Up;
                        using (TCEventArgs.PaintScrollBarArrowEventArgs args2 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, topLeftArrowRect, topLeftArrowState, arrowDirection, direction, enabled))
                        {
                            paint.OnPaintScrollBarArrow(args2);
                        }
                        arrowDirection = flag ? ArrowDirection.Right : ArrowDirection.Down;
                        using (TCEventArgs.PaintScrollBarArrowEventArgs args3 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, bottomRightArrowRect, bottomRightArrowState, arrowDirection, direction, enabled))
                        {
                            paint.OnPaintScrollBarArrow(args3);
                        }
                        using (TCEventArgs.PaintScrollBarThumbEventArgs args4 = new TCEventArgs.PaintScrollBarThumbEventArgs(graphics, thumbRect, thumbState, direction, enabled))
                        {
                            paint.OnPaintScrollBarThumb(args4);
                        }
                    }
                    Win32.NativeMethods.BitBlt(dC, 0, 0, bounds.Width, bounds.Height, dc.Hdc, 0, 0, 0xcc0020);
                }
                finally
                {
                    Win32.NativeMethods.ReleaseDC(maskHWnd, dC);
                    dc.Dispose();
                }
            }
        }
Example #3
0
 private void DrawScrollBar(IntPtr maskHWnd, Rectangle bounds, Rectangle trackRect, Rectangle topLeftArrowRect, Rectangle bottomRightArrowRect, Rectangle thumbRect, ControlState topLeftArrowState, ControlState bottomRightArrowState, ControlState thumbState, Orientation direction)
 {
     bool flag = direction == Orientation.Horizontal;
     bool enabled = this._owner.Enabled;
     IScrollBarPaint paint = this._owner as IScrollBarPaint;
     if (paint != null)
     {
         ImageDc dc = new ImageDc(bounds.Width, bounds.Height);
         IntPtr dC = Win32.NativeMethods.GetDC(maskHWnd);
         try
         {
             using (Graphics graphics = Graphics.FromHdc(dc.Hdc))
             {
                 using (TCEventArgs.PaintScrollBarTrackEventArgs args = new TCEventArgs.PaintScrollBarTrackEventArgs(graphics, trackRect, direction, enabled))
                 {
                     paint.OnPaintScrollBarTrack(args);
                 }
                 ArrowDirection arrowDirection = flag ? ArrowDirection.Left : ArrowDirection.Up;
                 using (TCEventArgs.PaintScrollBarArrowEventArgs args2 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, topLeftArrowRect, topLeftArrowState, arrowDirection, direction, enabled))
                 {
                     paint.OnPaintScrollBarArrow(args2);
                 }
                 arrowDirection = flag ? ArrowDirection.Right : ArrowDirection.Down;
                 using (TCEventArgs.PaintScrollBarArrowEventArgs args3 = new TCEventArgs.PaintScrollBarArrowEventArgs(graphics, bottomRightArrowRect, bottomRightArrowState, arrowDirection, direction, enabled))
                 {
                     paint.OnPaintScrollBarArrow(args3);
                 }
                 using (TCEventArgs.PaintScrollBarThumbEventArgs args4 = new TCEventArgs.PaintScrollBarThumbEventArgs(graphics, thumbRect, thumbState, direction, enabled))
                 {
                     paint.OnPaintScrollBarThumb(args4);
                 }
             }
             Win32.NativeMethods.BitBlt(dC, 0, 0, bounds.Width, bounds.Height, dc.Hdc, 0, 0, 0xcc0020);
         }
         finally
         {
             Win32.NativeMethods.ReleaseDC(maskHWnd, dC);
             dc.Dispose();
         }
     }
 }
Example #4
0
 void IScrollBarPaint.OnPaintScrollBarArrow(TCEventArgs.PaintScrollBarArrowEventArgs e)
 {
     this.OnPaintScrollBarArrow(e);
 }