private static void RenderIcon(StateButton sender, DrawingContext context, Brush foregroundBrush)
        {
            Rect   iconRect  = sender.IconRect;
            double thickness = iconRect.Width / 5;

            Point pL11 = iconRect.TopLeft;
            Point pL21 = new Point(iconRect.X + thickness * 2, iconRect.Y);
            Point pL22 = new Point(iconRect.X + thickness * 2, iconRect.Y + thickness);
            Point pL12 = new Point(iconRect.X + thickness * 1, iconRect.Y + thickness);
            Point pL13 = new Point(iconRect.X + thickness * 1, iconRect.Bottom - thickness);
            Point pL23 = new Point(iconRect.X + thickness * 2, iconRect.Bottom - thickness);
            Point pL24 = new Point(iconRect.X + thickness * 2, iconRect.Bottom);
            Point pL14 = iconRect.BottomLeft;

            Point pR11 = iconRect.TopRight;
            Point pR21 = new Point(iconRect.X + thickness * 3, iconRect.Y);
            Point pR22 = new Point(iconRect.X + thickness * 3, iconRect.Y + thickness);
            Point pR12 = new Point(iconRect.X + thickness * 4, iconRect.Y + thickness);
            Point pR13 = new Point(iconRect.X + thickness * 4, iconRect.Bottom - thickness);
            Point pR23 = new Point(iconRect.X + thickness * 3, iconRect.Bottom - thickness);
            Point pR24 = new Point(iconRect.X + thickness * 3, iconRect.Bottom);
            Point pR14 = iconRect.BottomRight;

            IEnumerable <PathFigure> leftFigures  = StateButton.GetFigureWithBoder(pL11, pL21, pL22, pL12, pL13, pL23, pL24, pL14);
            IEnumerable <PathFigure> rightFigures = StateButton.GetFigureWithBoder(pR11, pR21, pR22, pR12, pR13, pR23, pR24, pR14);

            Pen pen = new Pen(Brushes.Black, thickness * iconBorderThicknessFactor);

            context.DrawGeometry(foregroundBrush, pen, new PathGeometry(leftFigures));
            context.DrawGeometry(foregroundBrush, pen, new PathGeometry(rightFigures));
        }
        private static IEnumerable <PathFigure> GetArrow(Point offset, Size size)
        {
            Point p1 = new Point(offset.X, offset.Y);
            Point p2 = new Point(offset.X, offset.Y + size.Height);
            Point p3 = new Point(offset.X + size.Width, offset.Y + size.Height / 2);

            return(StateButton.GetFigureWithBoder(p1, p2, p3));
        }
        private static IEnumerable <PathFigure> GetStrokeFigures(StateButton sender)
        {
            Rect iconRect = sender.IconRect;

            Point p11 = iconRect.TopLeft;
            Point p12 = iconRect.BottomLeft;
            Point p21 = new Point(iconRect.X + iconRect.Width * iconStrokeWidthPercent, iconRect.Y);
            Point p22 = new Point(iconRect.X + iconRect.Width * iconStrokeWidthPercent, iconRect.Y + iconRect.Height);

            return(StateButton.GetFigureWithBoder(p11, p12, p22, p21));
        }
예제 #4
0
        private static IEnumerable <PathFigure> GetSquare(StateButton sender)
        {
            Rect iconRect = sender.IconRect;

            Point p11 = iconRect.TopLeft;
            Point p12 = iconRect.BottomLeft;
            Point p21 = iconRect.TopRight;
            Point p22 = iconRect.BottomRight;

            return(StateButton.GetFigureWithBoder(p11, p12, p22, p21));
        }
        private static void RenderEndIcon(StateButton sender, DrawingContext context, Brush backgroundBrush)
        {
            Rect   iconRect  = sender.IconRect;
            double thickness = iconRect.Height * iconStrokeThicknessFactor;

            Point pTopRight         = iconRect.TopRight;
            Point pBottomRight      = iconRect.BottomRight;
            Point pTopInner         = new Point(iconRect.X + iconRect.Width - thickness, iconRect.Y + thickness);
            Point pBottomInner      = new Point(iconRect.X + iconRect.Width - thickness, iconRect.Y + iconRect.Height - thickness);
            Point pTopLeftTop       = iconRect.TopLeft;
            Point pTopLeftBottom    = new Point(iconRect.X, iconRect.Y + thickness);
            Point pBottomLeftTop    = new Point(iconRect.X, iconRect.Y + iconRect.Height - thickness);
            Point pBottomLeftBottom = iconRect.BottomLeft;

            IEnumerable <PathFigure> figures = StateButton.GetFigureWithBoder(pTopLeftTop, pTopRight, pBottomRight,
                                                                              pBottomLeftBottom, pBottomLeftTop, pBottomInner, pTopInner, pTopLeftBottom);

            Brush iconBrush = Brushes.Gray;
            Pen   borderPen = new Pen(Brushes.Black, 0.5);

            context.DrawGeometry(iconBrush, borderPen, new PathGeometry(figures));
        }