ComponentFactory.Krypton.Toolkit.RenderStandard.DrawDragDockingArrow C# (CSharp) Method

DrawDragDockingArrow() private method

private DrawDragDockingArrow ( RenderContext context, Color active, Rectangle rect, VisualOrientation orientation ) : void
context RenderContext
active Color
rect System.Drawing.Rectangle
orientation VisualOrientation
return void
        private void DrawDragDockingArrow(RenderContext context,
                                          Color active,
                                          Rectangle rect,
                                          VisualOrientation orientation)
        {
            using (GraphicsPath innerPath = new GraphicsPath())
            {
                float angle = 0f;
                switch (orientation)
                {
                    case VisualOrientation.Left:
                        rect = new Rectangle(rect.Right - _dragArrowHeight - _dragArrowGap,
                                             rect.Y + (rect.Height - _dragArrowWidth) / 2,
                                             _dragArrowHeight, _dragArrowWidth);

                        innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Top + 6),
                                                         new Point(rect.Right - 1, rect.Top + 1),
                                                         new Point(rect.Right - 1, rect.Bottom - 2)});
                        break;
                    case VisualOrientation.Right:
                        rect = new Rectangle(rect.Left + _dragArrowGap,
                                             rect.Y + (rect.Height - _dragArrowWidth) / 2,
                                             _dragArrowHeight, _dragArrowWidth);

                        innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Top + 1),
                                                         new Point(rect.X + 1, rect.Bottom - 2),
                                                         new Point(rect.Right - 1, rect.Top + 6) });
                        angle = 180f;
                        break;
                    case VisualOrientation.Top:
                        rect = new Rectangle(rect.X + (rect.Width - _dragArrowWidth) / 2,
                                             rect.Bottom - _dragArrowHeight - _dragArrowGap - 1,
                                             _dragArrowWidth, _dragArrowHeight);

                        innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Bottom),
                                                         new Point(rect.Right - 1, rect.Bottom),
                                                         new Point(rect.X + 6, rect.Top + 1) });
                        angle = 90f;
                        break;
                    case VisualOrientation.Bottom:
                        rect = new Rectangle(rect.X + (rect.Width - _dragArrowWidth) / 2,
                                             rect.Top + _dragArrowGap,
                                             _dragArrowWidth, _dragArrowHeight);

                        innerPath.AddLines(new Point[] { new Point(rect.X + 2, rect.Top + 1),
                                                         new Point(rect.Right - 2, rect.Top + 1),
                                                         new Point(rect.X + 6, rect.Bottom - 1) });
                        angle = 270f;
                        break;
                }

                // Draw background in white top highlight the arrow
                using(AntiAlias aa = new AntiAlias(context.Graphics))
                    context.Graphics.FillPath(Brushes.White, innerPath);

                // Draw the actual arrow itself
                using(LinearGradientBrush innerBrush = new LinearGradientBrush(rect, ControlPaint.Dark(active), ControlPaint.Light(active), angle))
                    context.Graphics.FillPath(innerBrush, innerPath);
            }
        }
RenderStandard