コード例 #1
0
ファイル: ListenDesigner.cs プロジェクト: dox0/DotNet471RS3
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
            {
                return;
            }

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            Debug.Assert(compositeDesignerTheme != null);
            if (compositeDesignerTheme == null)
            {
                return;
            }

            //Draw the Icon and Text
            Rectangle bounds         = Bounds;
            Rectangle imageRectangle = ImageRectangle;

            Rectangle roundRectangle = Rectangle.Empty;

            roundRectangle.Width  = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height - 1;
            roundRectangle.Height = roundRectangle.Width;
            roundRectangle.X      = bounds.Left + bounds.Width / 2 - roundRectangle.Width / 2;
            roundRectangle.Y      = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;

            e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
            e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);

            roundRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - roundRectangle.Height) / 2;
            e.Graphics.FillEllipse(compositeDesignerTheme.ForegroundBrush, roundRectangle);
            e.Graphics.DrawEllipse(compositeDesignerTheme.ForegroundPen, roundRectangle);
        }
コード例 #2
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);
            string targetState = this.TargetState;

            ActivityDesignerPaint.DrawText(e.Graphics, e.DesignerTheme.Font, targetState, this.TargetStateRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, e.DesignerTheme.ForegroundBrush);
        }
コード例 #3
0
        private void PaintEditPoints(ActivityDesignerPaintEventArgs e, Point point, bool drawMidSegmentEditPoint)
        {
            Size size = (Source != null) ? Source.Bounds.Size : Size.Empty;

            if (!size.IsEmpty)
            {
                Rectangle bounds = new Rectangle(point.X - size.Width / 2, point.Y - size.Height / 2, size.Width, size.Height);
                if (drawMidSegmentEditPoint)
                {
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(new Point(bounds.Left + bounds.Width / 2, bounds.Top), new Point(bounds.Right, bounds.Top + bounds.Height / 2));
                        path.AddLine(new Point(bounds.Right, bounds.Top + bounds.Height / 2), new Point(bounds.Left + bounds.Width / 2, bounds.Bottom));
                        path.AddLine(new Point(bounds.Left + bounds.Width / 2, bounds.Bottom), new Point(bounds.Left, bounds.Top + bounds.Height / 2));
                        path.AddLine(new Point(bounds.Left, bounds.Top + bounds.Height / 2), new Point(bounds.Left + bounds.Width / 2, bounds.Top));

                        e.Graphics.FillPath(Brushes.White, path);
                        e.Graphics.DrawPath(e.AmbientTheme.SelectionForegroundPen, path);
                    }
                }
                else
                {
                    bounds.Inflate(-1, -1);
                    e.Graphics.FillEllipse(e.AmbientTheme.SelectionForegroundBrush, bounds);
                }
            }
        }
コード例 #4
0

        
コード例 #5
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (_icon == null)
            {
                throw new Exception("Invalid icon. You must set an icon from the child version of this class.");
            }

            frameRect = new Rectangle(this.Location.X, this.Location.Y, this.Size.Width - 5, this.Size.Height - 5);
            Rectangle shadowRect = new Rectangle(frameRect.X + 5, frameRect.Y + 5, frameRect.Width, frameRect.Height);

            this.pageRect = new Rectangle(frameRect.X + 4, frameRect.Y + 24, frameRect.Width - 8, frameRect.Height - 28);
            Rectangle titleRect = new Rectangle(frameRect.X + 16, frameRect.Y + 4, frameRect.Width / 2 + 10, 20);

            Brush frameBrush = new LinearGradientBrush(frameRect, Color.MediumSlateBlue, Color.DarkBlue, 45);

            e.Graphics.FillPath(Brushes.LightGray, RoundedRect(shadowRect));
            e.Graphics.FillPath(frameBrush, RoundedRect(frameRect));
            e.Graphics.FillPath(new LinearGradientBrush(pageRect, Color.White, Color.WhiteSmoke, 45), RoundedRect(pageRect));
            e.Graphics.DrawString("", new Font("Ariel", 9), Brushes.White, titleRect);
            frameRect.Inflate(20, 20);

            e.Graphics.DrawString(_title, new Font("Ariel", 9), Brushes.White, new Rectangle(this.pageRect.X + 5, this.pageRect.Y - 20, this.pageRect.Width, this.pageRect.Height));
            e.Graphics.DrawImage(_icon, new Rectangle(pageRect.X + 30, pageRect.Y + 5, 24, 24));
            this.newRect = new Rectangle(pageRect.X + pageRect.Width / 2 + 15, pageRect.Y + 10, 24, 24);
        }
コード例 #6
0
 protected override void OnPaintSelected(ActivityDesignerPaintEventArgs e, bool primarySelection, Point[] segmentEditPoints)
 {
     if ((this.RootStateDesigner == null) || (this.RootStateDesigner.ActiveDesigner == null))
     {
         StateMachineTheme designerTheme = e.DesignerTheme as StateMachineTheme;
         if (designerTheme != null)
         {
             Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
             Size connectorSize    = designerTheme.ConnectorSize;
             using (Pen pen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1f))
             {
                 StateMachineDesignerPaint.DrawConnector(e.Graphics, pen, new List <Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
             }
             if (base.Source != null)
             {
                 base.Source.OnPaint(e, false);
             }
             ReadOnlyCollection <Point> connectorSegments = this.ConnectorSegments;
             for (int i = 1; i < (connectorSegments.Count - 1); i++)
             {
                 this.PaintEditPoints(e, connectorSegments[i], false);
             }
             for (int j = 0; j < segmentEditPoints.Length; j++)
             {
                 this.PaintEditPoints(e, segmentEditPoints[j], true);
             }
             if (base.Target != null)
             {
                 base.Target.OnPaint(e, false);
             }
         }
     }
 }
コード例 #7
0
 protected override void OnPaintEdited(ActivityDesignerPaintEventArgs e, Point[] segments, Point[] segmentEditPoints)
 {
     if (((this.RootStateDesigner == null) || (this.RootStateDesigner.ActiveDesigner == null)) && (e.DesignerTheme is StateMachineTheme))
     {
         using (Pen pen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1f))
         {
             pen.DashStyle = DashStyle.Dash;
             e.Graphics.DrawLines(pen, segments);
             if (base.Source != null)
             {
                 base.Source.OnPaint(e, false);
             }
             for (int i = 1; i < (segments.Length - 1); i++)
             {
                 this.PaintEditPoints(e, segments[i], false);
             }
             for (int j = 0; j < segmentEditPoints.Length; j++)
             {
                 this.PaintEditPoints(e, segmentEditPoints[j], true);
             }
             if (base.Target != null)
             {
                 base.Target.OnPaint(e, false);
             }
         }
     }
 }
コード例 #8
0
        /// <summary>
        ///	We override the OnPaint method to draw an arrow that indicates that the execution
        /// flows back to the beginning of this activity after one iteration is completed.
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            // We begin with drawing the base sequntial activity shape.
            base.OnPaint(e);

            // We we draw the looping arrow.
            if (Expanded)
            {
                CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
                if (compositeDesignerTheme == null)
                {
                    return;
                }

                Rectangle bounds         = Bounds;
                Rectangle textRectangle  = TextRectangle;
                Rectangle imageRectangle = ImageRectangle;

                // First figure out where the upper looping arrow should end.  That's the point where the icon
                // image of the ForEach is inside the Bounds.
                Point connectionPoint = Point.Empty;
                if (!imageRectangle.IsEmpty)
                {
                    connectionPoint = new Point(imageRectangle.Left - e.AmbientTheme.Margin.Width / 2, imageRectangle.Top + imageRectangle.Height / 2);
                }
                else if (!textRectangle.IsEmpty)
                {
                    connectionPoint = new Point(textRectangle.Left - e.AmbientTheme.Margin.Width / 2, textRectangle.Top + textRectangle.Height / 2);
                }
                else
                {
                    connectionPoint = new Point((bounds.Left + bounds.Width / 2) - e.AmbientTheme.Margin.Width / 2, bounds.Top + e.AmbientTheme.Margin.Height / 2);
                }

                // Now contruct the 4 points where we would draw the looping arrow.  It starts at the lower-central line,
                // going to the lower right then up to upper right and finishes at the upper-central point.
                Point[] points = new Point[4];
                points[0].X = bounds.Left + bounds.Width / 2;
                points[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[1].X = bounds.Left + compositeDesignerTheme.ConnectorSize.Width / 3;
                points[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[2].X = bounds.Left + compositeDesignerTheme.ConnectorSize.Width / 3;
                points[2].Y = connectionPoint.Y;
                points[3].X = connectionPoint.X;
                points[3].Y = connectionPoint.Y;

                // Draw the loop.
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
                // Draw the last section of the downward arrow that connections the beginning of
                // the looping arrow to the bottom of the activity shape.
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { points[0], new Point(bounds.Left + bounds.Width / 2, bounds.Bottom) }, LineAnchor.None, LineAnchor.None);
            }
        }
コード例 #9
0
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     if ((this.RootStateDesigner == null) || (this.RootStateDesigner.ActiveDesigner == null))
     {
         StateMachineTheme designerTheme = e.DesignerTheme as StateMachineTheme;
         if (designerTheme != null)
         {
             Size connectorCapSize = new Size(designerTheme.ConnectorSize.Width / 5, designerTheme.ConnectorSize.Height / 5);
             Size connectorSize    = designerTheme.ConnectorSize;
             StateMachineDesignerPaint.DrawConnector(e.Graphics, designerTheme.ConnectorPen, new List <Point>(this.ConnectorSegments).ToArray(), connectorCapSize, connectorSize, designerTheme.ConnectorStartCap, designerTheme.ConnectorEndCap);
         }
     }
 }
コード例 #10
0
        protected override void OnPaintSelected(ActivityDesignerPaintEventArgs e, bool primarySelection, Point[] segmentEditPoints)
        {
            if (this.RootStateDesigner != null && this.RootStateDesigner.ActiveDesigner != null)
            {
                return; // we don't draw connectors in the EventDriven view
            }
            StateMachineTheme theme = e.DesignerTheme as StateMachineTheme;

            if (theme != null)
            {
                Size arrowCapSize = new Size(theme.ConnectorSize.Width / 5, theme.ConnectorSize.Height / 5);
                Size maxCapSize   = theme.ConnectorSize;

                using (Pen lineSelectionPen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1))
                {
                    StateMachineDesignerPaint.DrawConnector(e.Graphics,
                                                            lineSelectionPen,
                                                            new List <Point>(ConnectorSegments).ToArray(),
                                                            arrowCapSize,
                                                            maxCapSize,
                                                            theme.ConnectorStartCap,
                                                            theme.ConnectorEndCap);
                }

                if (this.Source != null)
                {
                    this.Source.OnPaint(e, false);
                }

                ReadOnlyCollection <Point> endSegmentEditPoints = ConnectorSegments;
                for (int i = 1; i < endSegmentEditPoints.Count - 1; i++)
                {
                    PaintEditPoints(e, endSegmentEditPoints[i], false);
                }

                for (int i = 0; i < segmentEditPoints.Length; i++)
                {
                    PaintEditPoints(e, segmentEditPoints[i], true);
                }

                if (this.Target != null)
                {
                    this.Target.OnPaint(e, false);
                }
            }
        }
コード例 #11
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (Expanded)
            {
                CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;
                Debug.Assert(compositeDesignerTheme != null);
                if (compositeDesignerTheme == null)
                {
                    return;
                }

                Rectangle bounds         = Bounds;
                Rectangle textRectangle  = TextRectangle;
                Rectangle imageRectangle = ImageRectangle;

                Point connectionPoint = Point.Empty;
                if (!imageRectangle.IsEmpty)
                {
                    connectionPoint = new Point(imageRectangle.Right + e.AmbientTheme.Margin.Width / 2, imageRectangle.Top + imageRectangle.Height / 2);
                }
                else if (!textRectangle.IsEmpty)
                {
                    connectionPoint = new Point(textRectangle.Right + e.AmbientTheme.Margin.Width / 2, textRectangle.Top + textRectangle.Height / 2);
                }
                else
                {
                    connectionPoint = new Point(bounds.Left + bounds.Width / 2 + e.AmbientTheme.Margin.Width / 2, bounds.Top + e.AmbientTheme.Margin.Height / 2);
                }

                Point[] points = new Point[4];
                points[0].X = bounds.Left + bounds.Width / 2;
                points[0].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[1].X = bounds.Right - compositeDesignerTheme.ConnectorSize.Width / 3;
                points[1].Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height / 3;
                points[2].X = bounds.Right - compositeDesignerTheme.ConnectorSize.Width / 3;
                points[2].Y = connectionPoint.Y;
                points[3].X = connectionPoint.X;
                points[3].Y = connectionPoint.Y;

                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
                DrawConnectors(e.Graphics, compositeDesignerTheme.ForegroundPen, new Point[] { points[0], new Point(bounds.Left + bounds.Width / 2, bounds.Bottom) }, LineAnchor.None, LineAnchor.None);
            }
        }
コード例 #12
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            if (!Expanded || ContainedDesigners.Count == 0 || this != ActiveView.AssociatedDesigner)
            {
                return;
            }

            CompositeDesignerTheme compositeDesignerTheme = e.DesignerTheme as CompositeDesignerTheme;

            Debug.Assert(compositeDesignerTheme != null);
            if (compositeDesignerTheme == null)
            {
                return;
            }

            //Draw the Icon and Text
            Rectangle bounds         = Bounds;
            Rectangle imageRectangle = ImageRectangle;

            Rectangle diamondRectangle = Rectangle.Empty;

            diamondRectangle.Width  = compositeDesignerTheme.ConnectorSize.Height - 2 * e.AmbientTheme.Margin.Height + 2;
            diamondRectangle.Height = diamondRectangle.Width;
            diamondRectangle.X      = bounds.Left + bounds.Width / 2 - diamondRectangle.Width / 2;
            diamondRectangle.Y      = bounds.Top + TitleHeight + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;

            using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
            {
                e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
                e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
            }

            diamondRectangle.Y = bounds.Bottom - compositeDesignerTheme.ConnectorSize.Height * 3 / 2 + (compositeDesignerTheme.ConnectorSize.Height * 3 / 2 - diamondRectangle.Height) / 2 + 1;
            using (GraphicsPath decisionDiamond = GetDiamondPath(diamondRectangle))
            {
                e.Graphics.FillPath(compositeDesignerTheme.ForegroundBrush, decisionDiamond);
                e.Graphics.DrawPath(compositeDesignerTheme.ForegroundPen, decisionDiamond);
            }
        }
コード例 #13
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);
            Rectangle incomingArrowRect = new Rectangle(this.Location.X - 2, this.Location.Y + 20, 24, 24);
            Rectangle outgoingArrowRect = new Rectangle(this.Location.X + 22, this.Location.Y + this.Size.Height - 45, -24, 24);

            e.Graphics.DrawImage(ImageResources.Arrow, incomingArrowRect);
            bool isOneWay = false;


            if (ReceiveActivity.ServiceOperationInfo != null)
            {
                // Refresh the referenced design time types in the serviceoperationInfo object properties;
                //ServiceOperationHelpers.RefreshReferencedDesignTimeTypes(this.Activity.Site as IServiceProvider, operation);
                isOneWay = this.ReceiveActivity.ServiceOperationInfo.GetIsOneWay(this.Activity.Site as IServiceProvider);
            }
            if (!isOneWay)
            {
                e.Graphics.DrawImage(ImageResources.Arrow, outgoingArrowRect);
            }
        }
コード例 #14
0
 protected override void OnPaint(ActivityDesignerPaintEventArgs e)
 {
     base.OnPaint(e);
     if (this.Expanded)
     {
         CompositeDesignerTheme designerTheme = e.DesignerTheme as CompositeDesignerTheme;
         if (designerTheme != null)
         {
             Rectangle bounds         = base.Bounds;
             Rectangle textRectangle  = this.TextRectangle;
             Rectangle imageRectangle = this.ImageRectangle;
             Point     empty          = Point.Empty;
             if (!imageRectangle.IsEmpty)
             {
                 empty = new Point(imageRectangle.Right + (e.AmbientTheme.Margin.Width / 2), imageRectangle.Top + (imageRectangle.Height / 2));
             }
             else if (!textRectangle.IsEmpty)
             {
                 empty = new Point(textRectangle.Right + (e.AmbientTheme.Margin.Width / 2), textRectangle.Top + (textRectangle.Height / 2));
             }
             else
             {
                 empty = new Point((bounds.Left + (bounds.Width / 2)) + (e.AmbientTheme.Margin.Width / 2), bounds.Top + (e.AmbientTheme.Margin.Height / 2));
             }
             Point[] points = new Point[4];
             points[0].X = bounds.Left + (bounds.Width / 2);
             points[0].Y = bounds.Bottom - (designerTheme.ConnectorSize.Height / 3);
             points[1].X = bounds.Right - (designerTheme.ConnectorSize.Width / 3);
             points[1].Y = bounds.Bottom - (designerTheme.ConnectorSize.Height / 3);
             points[2].X = bounds.Right - (designerTheme.ConnectorSize.Width / 3);
             points[2].Y = empty.Y;
             points[3].X = empty.X;
             points[3].Y = empty.Y;
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, points, LineAnchor.None, LineAnchor.ArrowAnchor);
             Point[] pointArray2 = new Point[] { points[0], new Point(bounds.Left + (bounds.Width / 2), bounds.Bottom) };
             base.DrawConnectors(e.Graphics, designerTheme.ForegroundPen, pointArray2, LineAnchor.None, LineAnchor.None);
         }
     }
 }
コード例 #15
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            if (this.RootStateDesigner != null && this.RootStateDesigner.ActiveDesigner != null)
            {
                return; // we don't draw connectors in the EventDriven view
            }
            StateMachineTheme theme = e.DesignerTheme as StateMachineTheme;

            if (theme != null)
            {
                Size arrowCapSize = new Size(theme.ConnectorSize.Width / 5, theme.ConnectorSize.Height / 5);
                Size maxCapSize   = theme.ConnectorSize;

                StateMachineDesignerPaint.DrawConnector(e.Graphics,
                                                        theme.ConnectorPen,
                                                        new List <Point>(ConnectorSegments).ToArray(),
                                                        arrowCapSize,
                                                        maxCapSize,
                                                        theme.ConnectorStartCap,
                                                        theme.ConnectorEndCap);
            }
        }
コード例 #16
0
        protected override void OnPaint(ActivityDesignerPaintEventArgs e)
        {
            base.OnPaint(e);

            Rectangle outgoingArrowRect = new Rectangle(this.Location.X + this.Size.Width - 24, this.Location.Y + 10, 24, 24);
            Rectangle incomingArrowRect = new Rectangle(this.Location.X + this.Size.Width, this.Location.Y + this.Size.Height - 35, -24, 24);

            e.Graphics.DrawImage(ImageResources.Arrow, outgoingArrowRect);
            bool isOneWay = false;


            if (SendActivity.ServiceOperationInfo != null)
            {
                OperationInfoBase operation = this.SendActivity.ServiceOperationInfo;
                // Refresh the contract type in the case the type is a Design Time type)
                //ServiceOperationHelpers.RefreshReferencedDesignTimeTypes(this.Activity.Site as IServiceProvider, operation);
                isOneWay = operation.GetIsOneWay(this.Activity.Site as IServiceProvider);
            }
            if (!isOneWay)
            {
                e.Graphics.DrawImage(ImageResources.Arrow, incomingArrowRect);
            }
        }
コード例 #17
0
        protected override void OnPaintEdited(ActivityDesignerPaintEventArgs e, Point[] segments, Point[] segmentEditPoints)
        {
            if (this.RootStateDesigner != null && this.RootStateDesigner.ActiveDesigner != null)
            {
                return; // we don't draw connectors in the EventDriven view
            }
            StateMachineTheme theme = e.DesignerTheme as StateMachineTheme;

            if (theme != null)
            {
                using (Pen lineEditPen = new Pen(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionForeColor, 1))
                {
                    lineEditPen.DashStyle = DashStyle.Dash;
                    e.Graphics.DrawLines(lineEditPen, segments);

                    if (Source != null)
                    {
                        Source.OnPaint(e, false);
                    }

                    for (int i = 1; i < segments.Length - 1; i++)
                    {
                        PaintEditPoints(e, segments[i], false);
                    }

                    for (int i = 0; i < segmentEditPoints.Length; i++)
                    {
                        PaintEditPoints(e, segmentEditPoints[i], true);
                    }

                    if (Target != null)
                    {
                        Target.OnPaint(e, false);
                    }
                }
            }
        }
コード例 #18
0
        private void PaintEditPoints(ActivityDesignerPaintEventArgs e, Point point, bool drawMidSegmentEditPoint)
        {
            Size size = (base.Source != null) ? base.Source.Bounds.Size : Size.Empty;

            if (!size.IsEmpty)
            {
                Rectangle rect = new Rectangle(point.X - (size.Width / 2), point.Y - (size.Height / 2), size.Width, size.Height);
                if (drawMidSegmentEditPoint)
                {
                    using (GraphicsPath path = new GraphicsPath())
                    {
                        path.AddLine(new Point(rect.Left + (rect.Width / 2), rect.Top), new Point(rect.Right, rect.Top + (rect.Height / 2)));
                        path.AddLine(new Point(rect.Right, rect.Top + (rect.Height / 2)), new Point(rect.Left + (rect.Width / 2), rect.Bottom));
                        path.AddLine(new Point(rect.Left + (rect.Width / 2), rect.Bottom), new Point(rect.Left, rect.Top + (rect.Height / 2)));
                        path.AddLine(new Point(rect.Left, rect.Top + (rect.Height / 2)), new Point(rect.Left + (rect.Width / 2), rect.Top));
                        e.Graphics.FillPath(Brushes.White, path);
                        e.Graphics.DrawPath(e.AmbientTheme.SelectionForegroundPen, path);
                        return;
                    }
                }
                rect.Inflate(-1, -1);
                e.Graphics.FillEllipse(e.AmbientTheme.SelectionForegroundBrush, rect);
            }
        }