Пример #1
1
        public static void DrawPoint(System.Drawing.Graphics g, PointType type, Color c, float w, float x, float y)
        {
            w = w/2;

            switch (type)
            {
                case PointType.TriangleUp:
                    var triangleUp = new[]
                            {
                                new PointF(x - w, y + w),
                                new PointF(x + w, y + w),
                                new PointF(x, y - w)
                            };
                    g.FillPolygon(new SolidBrush(c), triangleUp);
                    g.DrawPolygon(new Pen(Color.Black, 1), triangleUp);
                    break;

                case PointType.TriangleDown:
                    var triangleDown = new[]
                            {
                                new PointF(x - w, y - w),
                                new PointF(x + w, y - w),
                                new PointF(x, y + w)
                            };
                    g.FillPolygon(new SolidBrush(c), triangleDown);
                    g.DrawPolygon(new Pen(Color.Black, 1), triangleDown);
                    break;

                case PointType.Circle:
                    g.FillEllipse(new SolidBrush(c), x - w, y - w, 2 * w, 2 * w);
                    g.DrawEllipse(new Pen(Color.Black, 1), x - w, y - w, 2 * w, 2 * w);
                    break;
                case PointType.Square:
                    g.FillRectangle(new SolidBrush(c), x - w, y - w, 2 * w, 2 * w);
                    g.DrawRectangle(new Pen(Color.Black, 1), x - w, y - w, 2 * w, 2 * w);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Пример #2
0
        public override void paint(System.Drawing.Graphics g)
        {
            try
            {
                //put thread to sleep based upon chosen speed
                Thread.Sleep(speed);

                //create array to hold triangle points
                Point[] points = new Point[] {new Point (xLoc,yLoc), new Point (xLoc+20, yLoc), new Point(xLoc+10,yLoc+20)};

                //draw over old location in white
                g.DrawPolygon(new Pen(Color.White), points);
                lock (typeof(Thread))
                {
                    //move the triangle
                    xLoc = xLoc + directionX;
                    yLoc = yLoc + directionY;
                    //check if it hits the edges of the screen
                    checkEdgeCollision();
                }
                //redraw in new location
                points = new Point[] { new Point(xLoc, yLoc), new Point(xLoc + 20, yLoc), new Point(xLoc + 10, yLoc + 20) };
                g.DrawPolygon(new Pen(color), points);
            }
            catch(Exception e )
            {
                System.Console.WriteLine("Error in Thread Drawing" + e);
            }
        }
Пример #3
0
        protected override void DrawGraph(System.Drawing.Graphics g)
        {
            using (Pen pen = new Pen(PenColor, PenWidth))
            {
                Rectangle.Width = Math.Max(50, Rectangle.Width);
                Rectangle.Height = Math.Max(50, Rectangle.Height);

                var rect = DrawRectangle.GetNormalizedRectangle(Rectangle);

                PointF[] p = new PointF[4];
                p[0] = new PointF(rect.Left + rect.Width / 2.0F, rect.Top);
                p[1] = new PointF(rect.Left, rect.Top + rect.Height / 2.0F);
                p[2] = new PointF(rect.Left + rect.Width / 2.0F, rect.Bottom);
                p[3] = new PointF(rect.Right, rect.Top + rect.Height / 2.0F);

                PointF[] p2 = new PointF[4];
                for (int i = 0; i < 4; i++)
                {
                    p2[i] = new PointF(p[i].X + 3, p[i].Y + 3);
                }
                g.FillPolygon(Brushes.LightGray, p2);

                using (var brush = DrawRectangle.GetBackgroundBrush(rect, this.BackColor))
                {
                    g.FillPolygon(brush, p);
                }
                g.DrawPolygon(pen, p);

            }
        }
        /// <summary>
        /// 绘制子页面
        /// </summary>
        /// <param name="g">绘图画面</param>
        /// <param name="tabPage">tab页面</param>
        /// <param name="nIndex">页面索引</param>
        /// <param name="bHovered">是否hover状态 如果不是选中,就是hover状态</param>
        public virtual void DrawTab(System.Drawing.Graphics g, System.Windows.Forms.TabPage tabPage, int nIndex, bool bHovered)
        {
            Rectangle recBounds = _owner.GetTabRect(nIndex);
            RectangleF tabTextArea = (RectangleF)_owner.GetTabRect(nIndex);

            bool bSelected = (_owner.SelectedIndex == nIndex);



            if (bSelected)
            {
                Point[] pt = new Point[7];
                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        {

                            pt[0] = new Point(recBounds.Left, recBounds.Bottom);
                            pt[1] = new Point(recBounds.Left, recBounds.Top + 3);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Top);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Top);
                            pt[4] = new Point(recBounds.Right, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Right, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left, recBounds.Bottom);
                        }
                        break;
                    case TabAlignment.Bottom:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top);
                            pt[1] = new Point(recBounds.Right, recBounds.Top);
                            pt[2] = new Point(recBounds.Right, recBounds.Bottom - 3);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom);
                            pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom - 3);
                            pt[6] = new Point(recBounds.Left, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Left:
                        {
                            pt[0] = new Point(recBounds.Right, recBounds.Top);
                            pt[1] = new Point(recBounds.Right, recBounds.Bottom);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom);
                            pt[3] = new Point(recBounds.Left, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Left, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Left + 3, recBounds.Top);
                            pt[6] = new Point(recBounds.Right, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Right:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top);
                            pt[1] = new Point(recBounds.Right - 3, recBounds.Top);
                            pt[2] = new Point(recBounds.Right, recBounds.Top + 3);
                            pt[3] = new Point(recBounds.Right, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left, recBounds.Top);
                        }
                        break;

                }

                // fill this tab with background color
                Brush br = new SolidBrush(tabPage.BackColor);
                //Brush br = new SolidBrush(Color.White);
                g.FillPolygon(br, pt);
                br.Dispose();

                // draw border
                using (Pen pen1 = new Pen(Color.FromArgb(19, 28, 37)))
                {
                    g.DrawPolygon(pen1, pt);

                }

                #region 内边框

                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        {
                            pt[0] = new Point(recBounds.Left + 1, recBounds.Bottom);
                            pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 3);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Top + 1);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Top + 1);
                            pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Right - 1, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left + 1, recBounds.Bottom);
                        }
                        break;
                    case TabAlignment.Bottom:
                        {
                            pt[0] = new Point(recBounds.Left + 1, recBounds.Top);
                            pt[1] = new Point(recBounds.Right - 1, recBounds.Top);
                            pt[2] = new Point(recBounds.Right - 1, recBounds.Bottom - 3);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom - 1);
                            pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom - 1);
                            pt[5] = new Point(recBounds.Left + 1, recBounds.Bottom - 3);
                            pt[6] = new Point(recBounds.Left + 1, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Left:
                        {
                            pt[0] = new Point(recBounds.Right, recBounds.Top + 1);
                            pt[1] = new Point(recBounds.Right, recBounds.Bottom - 1);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom - 1);
                            pt[3] = new Point(recBounds.Left + 1, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Left + 1, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Left + 3, recBounds.Top + 1);
                            pt[6] = new Point(recBounds.Right, recBounds.Top + 1);
                        }
                        break;
                    case TabAlignment.Right:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top + 1);
                            pt[1] = new Point(recBounds.Right - 3, recBounds.Top + 1);
                            pt[2] = new Point(recBounds.Right - 1, recBounds.Top + 3);
                            pt[3] = new Point(recBounds.Right - 1, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom - 1);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom - 1);
                            pt[6] = new Point(recBounds.Left, recBounds.Top + 1);
                        }
                        break;

                }

                //----------------------------
                // fill this tab with background color
                //Brush br1 = new SolidBrush(Color.FromArgb(119,140,166));
                using (Pen pen1 = new Pen(Color.FromArgb(91, 125, 170)))
                {
                    g.DrawPolygon(pen1, pt);

                }
                #endregion







                //----------------------------
                // clear bottom lines
                Pen pen = new Pen(tabPage.BackColor);

                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        g.DrawLine(pen, recBounds.Left + 2, recBounds.Bottom, recBounds.Right - 2, recBounds.Bottom);
                        g.DrawLine(pen, recBounds.Left + 2, recBounds.Bottom + 1, recBounds.Right - 2, recBounds.Bottom + 1);
                        break;

                    case TabAlignment.Bottom:
                        g.DrawLine(pen, recBounds.Left + 2, recBounds.Top, recBounds.Right - 2, recBounds.Top);
                        g.DrawLine(pen, recBounds.Left + 2, recBounds.Top - 1, recBounds.Right - 2, recBounds.Top - 1);
                        break;
                    case TabAlignment.Left:
                        g.DrawLine(pen, recBounds.Right + 1, recBounds.Top + 2, recBounds.Right + 1, recBounds.Bottom - 2);
                        g.DrawLine(pen, recBounds.Right, recBounds.Top + 2, recBounds.Right, recBounds.Bottom - 2);
                        break;
                    case TabAlignment.Right:
                        g.DrawLine(pen, recBounds.Left - 1, recBounds.Top + 2, recBounds.Left - 1, recBounds.Bottom - 2);
                        g.DrawLine(pen, recBounds.Left, recBounds.Top + 2, recBounds.Left, recBounds.Bottom - 2);
                        break;
                }

                pen.Dispose();
                //----------------------------
            }
            else if (bHovered)//如果不是选中,是hover状态
            {
                Color tabBackColor = Color.FromArgb(61, 84, 115);
                Color tabBorderColor = Color.FromArgb(19, 28, 37);
                Color tabBorderInnerColor = Color.FromArgb(89, 114, 145);

                Point[] pt = new Point[7];

                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Bottom);
                            pt[1] = new Point(recBounds.Left, recBounds.Top + 3);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Top);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Top);
                            pt[4] = new Point(recBounds.Right, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Right, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left, recBounds.Bottom);
                        }
                        break;

                    case TabAlignment.Bottom:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top);
                            pt[1] = new Point(recBounds.Right, recBounds.Top);
                            pt[2] = new Point(recBounds.Right, recBounds.Bottom - 3);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom);
                            pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom - 3);
                            pt[6] = new Point(recBounds.Left, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Left:
                        {
                            pt[0] = new Point(recBounds.Right, recBounds.Top);
                            pt[1] = new Point(recBounds.Right, recBounds.Bottom);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom);
                            pt[3] = new Point(recBounds.Left, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Left, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Left + 3, recBounds.Top);
                            pt[6] = new Point(recBounds.Right, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Right:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top);
                            pt[1] = new Point(recBounds.Right - 3, recBounds.Top);
                            pt[2] = new Point(recBounds.Right, recBounds.Top + 3);
                            pt[3] = new Point(recBounds.Right, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left, recBounds.Top);
                        }
                        break;
                }




                //----------------------------
                // fill this tab with background color
                Brush br = new SolidBrush(tabBackColor);
                g.FillPolygon(br, pt);
                br.Dispose();
                //----------------------------
                //----------------------------
                // draw border
                using (Pen pen1 = new Pen(tabBorderColor))
                {
                    g.DrawPolygon(pen1, pt);

                }

                #region 内边框

                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        {
                            pt[0] = new Point(recBounds.Left + 1, recBounds.Bottom);
                            pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 3);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Top + 1);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Top + 1);
                            pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Right - 1, recBounds.Bottom);
                            pt[6] = new Point(recBounds.Left + 1, recBounds.Bottom);
                        }
                        break;

                    case TabAlignment.Bottom:
                        {
                            pt[0] = new Point(recBounds.Left + 1, recBounds.Top);
                            pt[1] = new Point(recBounds.Right - 1, recBounds.Top);
                            pt[2] = new Point(recBounds.Right - 1, recBounds.Bottom - 3);
                            pt[3] = new Point(recBounds.Right - 3, recBounds.Bottom - 1);
                            pt[4] = new Point(recBounds.Left + 3, recBounds.Bottom - 1);
                            pt[5] = new Point(recBounds.Left + 1, recBounds.Bottom - 3);
                            pt[6] = new Point(recBounds.Left + 1, recBounds.Top);
                        }
                        break;
                    case TabAlignment.Left:
                        {
                            pt[0] = new Point(recBounds.Right, recBounds.Top + 1);
                            pt[1] = new Point(recBounds.Right, recBounds.Bottom - 1);
                            pt[2] = new Point(recBounds.Left + 3, recBounds.Bottom - 1);
                            pt[3] = new Point(recBounds.Left + 1, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Left + 1, recBounds.Top + 3);
                            pt[5] = new Point(recBounds.Left + 3, recBounds.Top + 1);
                            pt[6] = new Point(recBounds.Right, recBounds.Top + 1);
                        }
                        break;
                    case TabAlignment.Right:
                        {
                            pt[0] = new Point(recBounds.Left, recBounds.Top + 1);
                            pt[1] = new Point(recBounds.Right - 3, recBounds.Top + 1);
                            pt[2] = new Point(recBounds.Right - 1, recBounds.Top + 3);
                            pt[3] = new Point(recBounds.Right - 1, recBounds.Bottom - 3);
                            pt[4] = new Point(recBounds.Right - 3, recBounds.Bottom - 1);
                            pt[5] = new Point(recBounds.Left, recBounds.Bottom - 1);
                            pt[6] = new Point(recBounds.Left, recBounds.Top + 1);
                        }
                        break;
                }



                //----------------------------
                // fill this tab with background color
                //Brush br1 = new SolidBrush(Color.FromArgb(119,140,166));
                using (Pen pen1 = new Pen(tabBorderInnerColor))
                {
                    g.DrawPolygon(pen1, pt);

                }
                #endregion







                //----------------------------
                // clear bottom lines
                Pen pen = new Pen(tabBorderColor);

                switch (_owner.Alignment)
                {
                    case TabAlignment.Top:
                        g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom, recBounds.Right - 1, recBounds.Bottom);
                        //g.DrawLine(pen, recBounds.Left + 1, recBounds.Bottom - 2, recBounds.Right - 1, recBounds.Bottom - 2);
                        break;
                    case TabAlignment.Bottom:
                        g.DrawLine(pen, recBounds.Left + 1, recBounds.Top, recBounds.Right - 1, recBounds.Top);
                        //g.DrawLine(pen, recBounds.Left + 1, recBounds.Top - 1, recBounds.Right - 1, recBounds.Top - 1);
                        break;
                    case TabAlignment.Left:
                        g.DrawLine(pen, recBounds.Right, recBounds.Top + 1, recBounds.Right, recBounds.Bottom - 1);
                        //g.DrawLine(pen, recBounds.Right - 1, recBounds.Top + 1, recBounds.Right - 1, recBounds.Bottom - 1);
                        break;
                    case TabAlignment.Right:
                        g.DrawLine(pen, recBounds.Left, recBounds.Top + 1, recBounds.Left, recBounds.Bottom - 1);
                        //g.DrawLine(pen, recBounds.Left + 1, recBounds.Top + 1, recBounds.Left + 1, recBounds.Bottom - 1);
                        break;
                }

                pen.Dispose();
            }


            //----------------------------

            //----------------------------
            // draw tab's icon
            if ((tabPage.ImageIndex >= 0) && (_owner.ImageList != null) && (_owner.ImageList.Images[tabPage.ImageIndex] != null))
            {
                int nLeftMargin = 8;
                int nRightMargin = 2;

                Image img = _owner.ImageList.Images[tabPage.ImageIndex];

                Rectangle rimage = new Rectangle(recBounds.X + nLeftMargin, recBounds.Y + 1, img.Width, img.Height);

                // adjust rectangles
                float nAdj = (float)(nLeftMargin + img.Width + nRightMargin);

                rimage.Y += (recBounds.Height - img.Height) / 2;
                tabTextArea.X += nAdj;
                tabTextArea.Width -= nAdj;

                // draw icon
                g.DrawImage(img, rimage);
            }
            //----------------------------

            //----------------------------
            // draw string
            StringFormat stringFormat = new StringFormat();
            stringFormat.Alignment = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;

            if (bSelected)
            {
                using (SolidBrush br = new SolidBrush(Color.White))
                {
                    g.DrawString(tabPage.Text, _owner.Font, br, tabTextArea, stringFormat);
                }
            }
            else
            {
                using (SolidBrush br = new SolidBrush(Color.FromArgb(147, 170, 199)))
                {
                    g.DrawString(tabPage.Text, _owner.Font, br, tabTextArea, stringFormat);
                }

            }
            //----------------------------
        }
Пример #5
0
        /// <summary>
		/// Renders a polygon to the map.
		/// </summary>
		/// <param name="g">Graphics reference</param>
		/// <param name="pol">Polygon to render</param>
		/// <param name="brush">Brush used for filling (null or transparent for no filling)</param>
		/// <param name="pen">Outline pen style (null if no outline)</param>
		/// <param name="clip">Specifies whether polygon clipping should be applied</param>
		/// <param name="map">Map reference</param>
		public static void DrawPolygon(System.Drawing.Graphics g, IPolygon pol, System.Drawing.Brush brush, System.Drawing.Pen pen, bool clip, IMap map)
		{
            try
            {
			    if (pol.Shell == null)
				    return;

			    if (pol.Shell.Coordinates.Length > 2)
                {
                    var points = Transform.TransformToImage(pol.Shell, map, SimplifyGeometryDuringRendering);

                    var solidBrush = brush as SolidBrush;
                    if (solidBrush != null && solidBrush.Color.A != 0)
                    {
                        g.FillPolygon(brush, points, FillMode.Alternate);
                    }

                    if (pen != null)
                    {
                        g.DrawPolygon(pen, points);
                    }

                    for (int i = 0; i < pol.Holes.Length; i++)
                    {
                        points = Transform.TransformToImage(pol.Holes[i], map, SimplifyGeometryDuringRendering);
                        if (solidBrush != null && solidBrush.Color.A != 0)
                        {
                            g.FillPolygon(brush, points);
                        }

                        if (pen != null)
                        {
                            g.DrawPolygon(pen, points);
                        }
                    }
                }
            }
            catch(InvalidOperationException e)
            {
                log.WarnFormat("Error during rendering", e);
            }
            catch (OverflowException e)
            {
                log.WarnFormat("Error during rendering", e);
            }
        }
        /// <summary>
        /// Paints the bundle on the canvas
        /// </summary>
        /// <param name="g"></param>
        public override void Paint(System.Drawing.Graphics g)
        {
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            //the shadow

            switch (mCurveType)
            {
                case MultiPointType.Straight:
                    g.DrawLines(ArtPallet.BlackPen, mPoints);
                    break;
                case MultiPointType.Polygon:
                    g.DrawPolygon(ArtPallet.BlackPen, mPoints);
                    break;
                case MultiPointType.Curve:
                    //note that you can specify a tension of the curve here (greater than 0.0F)
                    g.DrawCurve(ArtPallet.BlackPen, mPoints);
                    break;
            }
        }
Пример #7
0
        private void RenderTab(System.Drawing.Graphics g, int index)
        {
            var rect = GetTabRect(index);
            var closeRect = GetCloseRect(index);
            var selected = SelectedIndex == index;
            var tab = TabPages[index];

            var points = new[]
                             {
                                 new Point(rect.Left, rect.Bottom),
                                 new Point(rect.Left, rect.Top + 3),
                                 new Point(rect.Left + 3, rect.Top),
                                 new Point(rect.Right - 3, rect.Top),
                                 new Point(rect.Right, rect.Top + 3),
                                 new Point(rect.Right, rect.Bottom),
                                 new Point(rect.Left, rect.Bottom)
                             };

            // Background
            var p = PointToClient(MousePosition);
            var hoverClose = closeRect.Contains(p);
            var hover = rect.Contains(p);
            var backColour = tab.BackColor;
            if (selected) backColour = ControlPaint.Light(backColour, 1);
            else if (hover) backColour = ControlPaint.Light(backColour, 0.8f);
            using (var b = new SolidBrush(backColour))
            {
                g.FillPolygon(b, points);
            }
            // Border
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.DrawPolygon(SystemPens.ControlDark, points);
            if (selected)
            {
                using (var pen = new Pen(tab.BackColor))
                {
                    g.DrawLine(pen, rect.Left, rect.Bottom, rect.Right, rect.Bottom);
                }
            }
            // Text
            var textRect = new Rectangle(rect.X + 14, rect.Y + 5, rect.Width - 26, rect.Height - 5);
            using (var b = new SolidBrush(tab.ForeColor))
            {
                g.DrawString(tab.Text, Font, b, textRect);
            }
            // Close icon
            using (var pen = new Pen(tab.ForeColor))
            {
                if (hoverClose)
                {
                    g.DrawRectangle(pen, closeRect.Left + 1, closeRect.Top + 1, closeRect.Width - 2, closeRect.Height - 2);
                }
                const int padding = 5;
                g.DrawLine(pen, closeRect.Left + padding, closeRect.Top + padding, closeRect.Right - padding, closeRect.Bottom - padding);
                g.DrawLine(pen, closeRect.Right - padding, closeRect.Top + padding, closeRect.Left + padding, closeRect.Bottom - padding);
            }
        }
Пример #8
0
 public void Solve(System.Drawing.Graphics g, List<PointF> pointList, PictureBox pictureBoxView)
 {
     pointList.Sort((p1, p2) => (p1.X.CompareTo(p2.X)));
     PointF[] pointArray = solveConvexHull(pointList).ToArray();
     g.DrawPolygon(new Pen(Color.Blue), pointArray);
 }