private void FillLastSeriesGradient(ChartGraphics graph) { if (areaPath != null) { areaPath.AddLine(areaPath.GetLastPoint().X, areaPath.GetLastPoint().Y, areaPath.GetLastPoint().X, areaBottomPath.GetLastPoint().Y); } if (gradientFill && areaPath != null) { graph.SetClip(area.PlotAreaPosition.ToRectangleF()); GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddPath(areaPath, connect: true); areaBottomPath.Reverse(); graphicsPath.AddPath(areaBottomPath, connect: true); Brush gradientBrush = graph.GetGradientBrush(graphicsPath.GetBounds(), series.Color, series.BackGradientEndColor, series.BackGradientType); graph.FillPath(gradientBrush, graphicsPath); gradientFill = false; graph.ResetClip(); } if (areaPath != null) { areaPath.Dispose(); areaPath = null; } areaBottomPath.Reset(); }
public Rectangle set_upRectangle(Rectangle re_out, int w, int C_Angle) { GraphicsPath myPath_Dout = new GraphicsPath(); myPath_Dout.AddArc(re_out, 90, C_Angle);//追加一椭圆 float fx = myPath_Dout.GetLastPoint().X; float fy = myPath_Dout.GetLastPoint().Y; int rx = Convert.ToInt32(fx + w / 2 * Math.Sin(Math.PI * (180 - C_Angle) / 180) - w / 2); int ry = Convert.ToInt32(fy - w / 2 * Math.Cos(Math.PI * C_Angle / 180) - w / 2); GraphicsPath myPath_Dup = new GraphicsPath(); Rectangle upRectangle = new Rectangle(rx, ry, w, w); return(upRectangle); }
internal void UpdateGraphicsPath() { if (graphicsPath == null) { graphicsPath = new GraphicsPath(); } else { graphicsPath.Reset(); } { for (int i = 0; i < LocalPoints.Count; i++) { GPoint p2 = LocalPoints[i]; if (i == 0) { graphicsPath.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = graphicsPath.GetLastPoint(); graphicsPath.AddLine(p.X, p.Y, p2.X, p2.Y); } } } }
internal void UpdateGraphicsPath() { if (graphicsPath == null) { graphicsPath = new GraphicsPath(); } else { graphicsPath.Reset(); } { for (int i = 0; i < LocalPoints.Count; i++) { GPoint p2 = LocalPoints[i]; if (Math.Abs(p2.X) > 5000 || Math.Abs(p2.Y) > 5000) { Stroke.DashStyle = DashStyle.Solid; } if (i == 0) { graphicsPath.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = graphicsPath.GetLastPoint(); graphicsPath.AddLine(p.X, p.Y, p2.X, p2.Y); } } } }
public override void UpdateGraphicsPath() { if (fGraphicsPath == null) { fGraphicsPath = new GraphicsPath(); } else { fGraphicsPath.Reset(); } for (int i = 0; i < LocalPoints.Count; i++) { GPoint p2 = LocalPoints[i]; if (i == 0) { fGraphicsPath.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { PointF p = fGraphicsPath.GetLastPoint(); fGraphicsPath.AddLine(p.X, p.Y, p2.X, p2.Y); } } }
internal void UpdateGraphicsPath() { if (_graphicsPath == null) { _graphicsPath = new GraphicsPath(); } else { _graphicsPath.Reset(); } { for (int i = 0; i < LocalPoints.Count; i++) { var p2 = LocalPoints[i]; if (i == 0) { _graphicsPath.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { var p = _graphicsPath.GetLastPoint(); _graphicsPath.AddLine(p.X, p.Y, p2.X, p2.Y); } } } }
private GraphicsPath BuildPath(HashSet <BorderLine> lines) { lines = new HashSet <BorderLine>(lines); GraphicsPath path = new GraphicsPath(); int x; BorderLine points = lines.First(); path.StartFigure(); path.AddLine(points.mStart, points.mEnd); lines.Remove(points); while (lines.Count > 0) { x = lines.Count; foreach (BorderLine line in lines.Where(line => path.GetLastPoint() == (PointF)line.mStart)) { path.AddLine(line.mStart, line.mEnd); lines.Remove(line); break; } if (x == lines.Count) { path.StartFigure(); points = lines.First(); path.AddLine(points.mStart, points.mEnd); lines.Remove(points); } } return(path); }
/// <summary> /// draw polygons, override to draw custom /// </summary> /// <param name="g"></param> protected virtual void DrawPolygons(Graphics g) { #if !PocketPC foreach (GMapPolygon r in Polygons) { if (r.IsVisible) { using (GraphicsPath rp = new GraphicsPath()) { for (int i = 0; i < r.LocalPoints.Count; i++) { GPoint p2 = r.LocalPoints[i]; if (i == 0) { rp.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = rp.GetLastPoint(); rp.AddLine(p.X, p.Y, p2.X, p2.Y); } } if (rp.PointCount > 0) { rp.CloseFigure(); if (!(((SolidBrush)r.Fill).Color.A == 155 && ((SolidBrush)r.Fill).Color.B == 255 && ((SolidBrush)r.Fill).Color.G == 248 && ((SolidBrush)r.Fill).Color.R == 240)) { g.FillPath(r.Fill, rp); } g.DrawPath(r.Stroke, rp); } } } } #else foreach (GMapPolygon r in Polygons) { if (r.IsVisible) { Point[] pnts = new Point[r.LocalPoints.Count]; for (int i = 0; i < r.LocalPoints.Count; i++) { Point p2 = new Point(r.LocalPoints[i].X, r.LocalPoints[i].Y); pnts[pnts.Length - 1 - i] = p2; } if (pnts.Length > 0) { g.FillPolygon(r.Fill, pnts); g.DrawPolygon(r.Stroke, pnts); } } } #endif }
private void drawGraphicsPathAndSetEndPoint(ref GraphicsPath graphicsPath, int iX, int iY, int iArcWidth, int iArcHeight , int startAngle, PointType startPointType, PointType endPointType) { graphicsPath.AddArc(iX, iY, iArcWidth, iArcHeight, startAngle, 90); creatOrUpdateEndPoint(ref m_pPoints[0], graphicsPath.PathPoints[0], startPointType); creatOrUpdateEndPoint(ref m_pPoints[1], graphicsPath.GetLastPoint(), endPointType); }
public static GraphicsPath GetRoundPath(int radius, int offs_x, int offs_y, int width, int height) { var pth = new GraphicsPath(); pth.AddArc(offs_x, offs_y, radius, height, 90, 180); pth.AddLine(offs_x + radius, offs_y, offs_x + width - radius, offs_y); pth.AddArc(offs_x + width - radius, offs_y, radius, height, 270, 180); pth.AddLine(pth.GetLastPoint(), pth.PathPoints[0]); return(pth); }
public override GraphicsPath CreatePath(Rectangle bounds) { GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddArc(new Rectangle(bounds.X, bounds.Y, bounds.Width / 2, bounds.Height / 2), 150f, 210f); graphicsPath.AddArc(new Rectangle(bounds.X + bounds.Width / 2, bounds.Y, bounds.Width / 2, bounds.Height / 2), 180f, 210f); graphicsPath.AddLine(graphicsPath.GetLastPoint(), (PointF) new Point(bounds.X + bounds.Width / 2, bounds.Bottom)); graphicsPath.CloseFigure(); return(graphicsPath); }
public void CheckLastPointFromPath() { Point from = new Point(1, 1); Size size = new Size(10, 10); Rectangle rect = new Rectangle(from, size); GraphicsPath p = Sut.CreatePath(rect); PointF last = p.GetLastPoint(); Assert.AreEqual(new Point(from.X, from.Y + size.Height), Point.Truncate(last)); }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { PointF controlPoint1 = (Control1.HasValue ? Control1.Value : pathObject.GetLastPoint()); PointF finalPoint = Point; PointF controlPoint2 = (Control2.HasValue ? Control2.Value : finalPoint); pathObject.AddBezier( pathObject.GetLastPoint(), controlPoint1, controlPoint2, finalPoint ); } }
public void CheckLastPointFromLine() { LineShape ls = new LineShape(); Point from = new Point(1, 1); Point to = new Point(10, 10); GraphicsPath p = ls.CreatePath(from, to); PointF last = p.GetLastPoint(); Assert.AreEqual(to, Point.Truncate(last)); }
private Region CalculateFirstQuarterRegion(double completeFactor, int radius, int cx, int cy) { GraphicsPath startingPath = GetStartingPath(cx, cy, radius); Point circlePoint = GetCirclePoint(completeFactor, cx, cy, radius); Point pt1 = new Point(circlePoint.X, cy - radius); startingPath.AddLine(startingPath.GetLastPoint(), pt1); startingPath.AddLine(pt1, circlePoint); startingPath.CloseFigure(); return(new Region(startingPath)); }
private Region CalculateSecondQuarterRegion(double completeFactor, int radius, int cx, int cy) { Point circlePoint = GetCirclePoint(completeFactor, cx, cy, radius); Point pt1 = new Point(cx + radius, circlePoint.Y); GraphicsPath startingPath = GetStartingPath(cx, cy, radius); AddTopRightCorner(startingPath, radius, cx, cy); startingPath.AddLine(startingPath.GetLastPoint(), pt1); startingPath.AddLine(pt1, circlePoint); startingPath.CloseFigure(); return(new Region(startingPath)); }
public override void Scan( ContentScanner.GraphicsState state ) { GraphicsPath pathObject = state.Scanner.RenderObject; if (pathObject != null) { PointF point = Point; pathObject.AddLine(pathObject.GetLastPoint(), point); } }
public virtual void OnRender(Graphics g) { #if !PocketPC if (IsVisible) { using (GraphicsPath rp = new GraphicsPath()) { for (int i = 0; i < LocalPoints.Count; i++) { GPoint p2 = LocalPoints[i]; if (i == 0) { rp.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = rp.GetLastPoint(); rp.AddLine(p.X, p.Y, p2.X, p2.Y); } } if (rp.PointCount > 0) { rp.CloseFigure(); g.FillPath(Fill, rp); g.DrawPath(Stroke, rp); } } } #else { if (IsVisible) { Point[] pnts = new Point[LocalPoints.Count]; for (int i = 0; i < LocalPoints.Count; i++) { Point p2 = new Point((int)LocalPoints[i].X, (int)LocalPoints[i].Y); pnts[pnts.Length - 1 - i] = p2; } if (pnts.Length > 0) { g.FillPolygon(Fill, pnts); g.DrawPolygon(Stroke, pnts); } } } #endif }
/// <summary> /// draw routes, override to draw custom /// </summary> /// <param name="g"></param> protected virtual void DrawRoutes(Graphics g) { #if !PocketPC foreach (GMapRoute r in Routes) { if (r.IsVisible) { using (GraphicsPath rp = new GraphicsPath()) { for (int i = 0; i < r.LocalPoints.Count; i++) { GMap.NET.Point p2 = r.LocalPoints[i]; if (i == 0) { rp.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = rp.GetLastPoint(); rp.AddLine(p.X, p.Y, p2.X, p2.Y); } } if (rp.PointCount > 0) { g.DrawPath(r.Stroke, rp); } } } } #else foreach (GMapRoute r in Routes) { if (r.IsVisible) { Point[] pnts = new Point[r.LocalPoints.Count]; for (int i = 0; i < r.LocalPoints.Count; i++) { Point p2 = new Point(r.LocalPoints[i].X, r.LocalPoints[i].Y); pnts[pnts.Length - 1 - i] = p2; } if (pnts.Length > 0) { g.DrawLines(r.Stroke, pnts); } } } #endif }
public void DrawCurvedLine(Graphics g, PointF[] points, int radius) { using (GraphicsPath path = new GraphicsPath()) { PointF lastQ = new PointF(0, 0); PointF nextStart = new PointF(points[0].X, points[0].Y); for (int i = 0; i < points.Length - 2; i++) { PointF Q = GetQ(points[i], points[i + 1], points[i + 2], radius); PointF A = points[i + 1].Take(points[i]).Normalised(); PointF B = points[i + 2].Take(points[i + 1]).Normalised(); float toLeave = Math.Abs(Q.Dot(A)); PointF toDraw = A.ScaleBy(points[i].DistanceTo(points[i + 1]) - toLeave); path.AddLine(nextStart.X, nextStart.Y, toDraw.X + points[i].X, toDraw.Y + points[i].Y); nextStart = B.ScaleBy(Math.Abs(Q.Dot(B))).Plus(points[i + 1]); //path.AddBezier(toDraw.X + points[i].X, toDraw.Y + points[i].Y, points[i + 1].X, points[i + 1].Y, points[i + 1].X, points[i + 1].Y, nextStart.X, nextStart.Y); var arcLocation = Q.Plus(points[i + 1]).Plus(-radius, -radius); float a1 = (float)(Math.Atan2(A.Y, A.X) * 180 / Math.PI); float a2 = (float)(Math.Atan2(B.Y, B.X) * 180 / Math.PI); float dif21 = a2 - a1; if (dif21 < 0) { dif21 += 360; } float dif12 = a1 - a2; if (dif12 < 0) { dif12 += 360; } path.AddArc(arcLocation.X, arcLocation.Y, radius * 2.0f, radius * 2.0f, a1 + dif12, Math.Abs(-dif12) < Math.Abs(dif21) ? -dif12 : dif21); //path.AddArc(arcLocation.X, arcLocation.Y, radius, radius, a1, dif12); lastQ = Q; } path.AddLine(path.GetLastPoint(), new PointF(points[points.Length - 1].X, points[points.Length - 1].Y)); //g.DrawLines(Outline, points); //for (int i = 1; i < points.Length - 1; i++) //DrawArc(g, points[i - 1], points[i], points[i + 1], radius); g.DrawPath(Outline, path); } }
/// <summary> /// Erzeugt einen Pfad zur Darstellung als Ring /// </summary> /// <returns>Der gewünscte Pfad</returns> private GraphicsPath createPathRing() { //Verschiedene Winkel berechnen float alpha = (float)berechneAlpha(); float alphaDegree = (float)((alpha / (2 * Math.PI)) * 360); float phi = PositionSektor * alpha; float phi2 = (PositionSektor + 1) * alpha; float phiDegree = (float)((phi / (2 * Math.PI)) * 360); float phi2Degree = (float)((phi2 / (2 * Math.PI)) * 360); //Radien berechnen float rAussen = (float)((PositionSchicht + 1) * SegmentBreite); float rInnen = (float)(PositionSchicht * SegmentBreite); //Rechtecke berechnen RectangleF recAussen = new RectangleF( (float)(this.CenterX - rAussen), (float)(this.CenterY - rAussen), (float)(2 * rAussen), (float)(2 * rAussen)); RectangleF recInnen = new RectangleF( (float)(this.CenterX - rInnen), (float)(this.CenterY - rInnen), (float)(2 * rInnen), (float)(2 * rInnen)); //Pfad berechnen GraphicsPath result = new GraphicsPath(); result.AddArc(recAussen, phiDegree + ShiftDegree, alphaDegree); //Bogen A-B //Punkt C berechnen double Cx = this.CenterX + Math.Cos(phi2 + Shift) * rInnen; double Cy = this.CenterY + Math.Sin(phi2 + Shift) * rInnen; PointF C = new PointF((float)Cx, (float)Cy); PointF B = result.GetLastPoint(); result.AddLine(B, C); //B-C result.AddArc(recInnen, phi2Degree + ShiftDegree, -alphaDegree); //Bogen C-D result.CloseFigure(); //D-A return(result); }
// </snippet20> // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.GetLastPoint // <snippet21> private void GetLastPointExample(PaintEventArgs e) { GraphicsPath myPath = new GraphicsPath(); myPath.AddLine(20, 20, 100, 20); PointF lastPoint = myPath.GetLastPoint(); if (lastPoint.IsEmpty == false) { string lastPointXString = lastPoint.X.ToString(); string lastPointYString = lastPoint.Y.ToString(); MessageBox.Show(lastPointXString + ", " + lastPointYString); } else { MessageBox.Show("lastPoint is empty"); } }
public override void OnRender(System.Drawing.Graphics g) { //Point[] pnts = new Point[LocalPoints.Count]; //for (int i = 0; i < LocalPoints.Count; i++) //{ // Point p2 = new Point((int)LocalPoints[i].X, (int)LocalPoints[i].Y); // pnts[pnts.Length - 1 - i] = p2; //} //if (pnts.Length > 0) //{ // g.FillPolygon(Fill, pnts); // g.DrawPolygon(Stroke, pnts); //} using (GraphicsPath rp = new GraphicsPath()) { for (int i = 0; i < LocalPoints.Count; i++) { GPoint p2 = LocalPoints[i]; if (i == 0) { rp.AddLine(p2.X, p2.Y, p2.X, p2.Y); } else { System.Drawing.PointF p = rp.GetLastPoint(); rp.AddLine(p.X, p.Y, p2.X, p2.Y); } } if (rp.PointCount > 0) { rp.FillMode = FillMode.Winding; Pen custom = new Pen(Color.FromArgb(155, Color.Red)); custom.Width = 5; //rp.CloseFigure(); g.FillPath(new SolidBrush(Color.FromArgb(155, Color.Pink)), rp); g.DrawPath(custom, rp); custom.Dispose(); } } }
/// <summary> /// Get3s the d shine path. /// </summary> /// <param name="container">The container.</param> /// <param name="shape">The shape.</param> /// <returns>GraphicsPath.</returns> public static GraphicsPath Get3DShinePath(Rectangle container, ControlShape shape) { GraphicsPath path = new GraphicsPath(); Rectangle pathRect = container; pathRect.Width -= 1; pathRect.Height -= 1; RectangleF halfRect = new RectangleF(pathRect.X, pathRect.Y, pathRect.Width, pathRect.Height / 2f); if (pathRect.Height > 0 && pathRect.Width > 0) { switch (shape) { case ControlShape.Rect: path.AddRectangle(halfRect); break; case ControlShape.RoundedRect: //radius is 10% of smallest side int rad = (int)(Math.Min(halfRect.Height, halfRect.Width) * ROUNDED_RECT_RAD_PERCENT); CustomExtensions.AddRoundedRectangle(path, halfRect, rad); break; case ControlShape.Circular: path.AddArc(pathRect, 180, 142); PointF[] pts = new PointF[] { path.GetLastPoint(), new PointF(container.Width * .70f, container.Height * .33f), new PointF(container.Width * .25f, container.Height * .5f), path.PathPoints[0] }; path.AddCurve(pts); path.CloseFigure(); break; } } return(path); }
private void Init(bool startTimer = false) { tmr.Stop(); if (wheel != null) { wheel.Dispose(); wheel = null; } CreateWheel(r); using (Matrix m = new Matrix(1, 0, 0, 1, R, -r)) { RectangleF b = wheel.GetBounds(); //Поворот колеса в исходное положение, чтобы точка на ободе совпадала с точкой касания к окружности качения //m.RotateAt((float)(Math.Asin(radius / (R + radius)) * 180 / PI), new PointF(b.Left + b.Width / 2, b.Top + b.Height / 2)); wheel.Transform(m); } points = new PointF[1] { wheel.GetLastPoint() }; tmr.Enabled = startTimer; }
GraphicsPath GetSector(float startAngle, float endAngle, float r1, float r2) { GraphicsPath ret = new GraphicsPath(); float[] xx = new float[4]; float[] yy = new float[4]; ret.AddArc(-r1, -r1, 2 * r1, 2 * r1, startAngle, endAngle - startAngle); GraphicsPath gptemp = new GraphicsPath(); gptemp.AddArc(-r2, -r2, 2 * r2, 2 * r2, startAngle, endAngle - startAngle); ret.AddLine(ret.GetLastPoint(), gptemp.GetLastPoint()); ret.AddArc(-r2, -r2, 2 * r2, 2 * r2, endAngle, -(endAngle - startAngle)); //ret.AddArc(-r2, -r2, 2 * r2, 2 * r2, startAngle, endAngle - startAngle); ret.AddLine(gptemp.PathPoints[0], ret.PathPoints[0]); ret.CloseAllFigures(); return(ret); startAngle *= (float)(Math.PI / 180.0f); endAngle *= (float)(Math.PI / 180.0f); xx[0] = (float)(r1 * Math.Cos(startAngle)); xx[1] = (float)(r2 * Math.Cos(startAngle)); xx[2] = (float)(r1 * Math.Cos(endAngle)); xx[3] = (float)(r2 * Math.Cos(endAngle)); yy[0] = (float)(r1 * Math.Sin(startAngle)); yy[1] = (float)(r2 * Math.Sin(startAngle)); yy[2] = (float)(r1 * Math.Sin(endAngle)); yy[3] = (float)(r2 * Math.Sin(endAngle)); ret.AddPolygon(new PointF[] { new PointF(xx[0], yy[0]), new PointF(xx[1], yy[1]), new PointF(xx[2], yy[2]), new PointF(xx[3], yy[3]), }); return(ret); }
private void Form5_MouseClick(object sender, MouseEventArgs e) { if (Closed) { return; } try { if (Path.PathPoints != null && Path.PathPoints.Any()) { Path.AddLine(Path.GetLastPoint(), e.Location); } else { Path.AddLine(e.Location, e.Location); } } catch (ArgumentException) { Path.AddLine(e.Location, e.Location); } Refresh(); }
/// <summary> /// Clip the line, defaults to flattening the path and intersecting every line. /// If a more efficient method is available it can be overridden /// </summary> /// <param name="sourcePoint"></param> /// <returns></returns> internal virtual PointF ClipLine(PointF sourcePoint) { PointF intersect = Center; float distance = GraphUtils.CalculateDistance(sourcePoint, Center); using (GraphicsPath path = GetPath()) { path.Flatten(); if (path.PointCount > 0) { PointF lastPoint = path.GetLastPoint(); // Intersect all the lines in the path with our line and choose the closest for (int i = 0; i < path.PointCount; ++i) { PointF currIntersect; if (GraphUtils.IntersectLine(sourcePoint, this.Center, lastPoint, path.PathPoints[i], out currIntersect)) { float newDistance = GraphUtils.CalculateDistance(sourcePoint, currIntersect); if (newDistance < distance) { distance = newDistance; intersect = currIntersect; } } lastPoint = path.PathPoints[i]; } } } return(intersect); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); UpdateTabLocations(); Brush selBrush = new SolidBrush(owner.Navigator.PageBackColor); Pen pathPen = SystemPens.ControlDark; Rectangle pageExtendRect = new Rectangle(); switch (owner.Navigator.Location) { case NavigatorLocation.Bottom: pageExtendRect = new Rectangle(0, 0, ClientSize.Width, pageHeight); break; case NavigatorLocation.Top: pageExtendRect = new Rectangle(0, NavMinSize.Height - pageHeight, ClientSize.Width, pageHeight); break; } e.Graphics.FillRectangle(selBrush, pageExtendRect); // draw the tab outline GraphicsPath path = new GraphicsPath(); Point drawPoint = new Point(0, pageHeight); for (int i = 0; i < visiblePages.Count; i++) { TabRenderInfo info = tabs[i]; Rectangle rect = tabs[i].Bounds; NotebookPage page = visiblePages[i]; Font thisFont = this.Font; drawPoint = rect.Location; switch (owner.Navigator.Location) { case NavigatorLocation.Top: drawPoint.Y += tabMargin; break; } // fill background of the selected page if (owner.SelectedPage == page) { Rectangle fillRect = new Rectangle(); thisFont = mBoldFont; // add the right lines to the path to go around the tab switch (owner.Navigator.Location) { case NavigatorLocation.Top: path.AddLines(new Point[] { new Point(rect.Left, rect.Bottom), new Point(rect.Left, rect.Top + 2), new Point(rect.Left + 2, rect.Top), new Point(rect.Right - 2, rect.Top), new Point(rect.Right, rect.Top + 2), new Point(rect.Right, rect.Bottom) }); fillRect = new Rectangle( rect.Left + 1, rect.Top + 1, rect.Width - 1, rect.Height); break; case NavigatorLocation.Bottom: path.AddLines(new Point[] { rect.Location, new Point(rect.Left, rect.Bottom - 2), new Point(rect.Left + 2, rect.Bottom), new Point(rect.Right - 2, rect.Bottom), new Point(rect.Right, rect.Bottom - 2), new Point(rect.Right, rect.Top) }); fillRect = new Rectangle( rect.Left + 1, rect.Top, rect.Width - 1, rect.Height - 1); break; } e.Graphics.FillRectangle(selBrush, fillRect); } else { switch (owner.Navigator.Location) { case NavigatorLocation.Bottom: path.AddLine(rect.Location, new Point(rect.Right, rect.Top)); break; case NavigatorLocation.Top: path.AddLine(new Point(rect.X, rect.Bottom), new Point(rect.Right, rect.Bottom)); break; } if (i > 0) { e.Graphics.DrawLine(pathPen, new Point(rect.Left, rect.Top + 4), new Point(rect.Left, rect.Bottom - 4)); } } drawPoint.X += tabMargin; // draw page image if (page.Image != null) { drawPoint.X += imageMargin; Rectangle imageRect = new Rectangle(drawPoint, info.imageSize); imageRect.Y += (rect.Height - imageRect.Height) / 2; e.Graphics.DrawImage(page.Image, imageRect); drawPoint.X += info.imageSize.Width + imageMargin; } if (navProperties.AllowClose && info.ShowCloseBox) { Image image = Properties.Resources.Close; if (mOverCloseBox == i) { image = Properties.Resources.CloseMouseOver; } e.Graphics.DrawImage(image, info.CloseBox); } Rectangle textRect = Rectangle.FromLTRB( drawPoint.X, drawPoint.Y, rect.Right - tabMargin, rect.Bottom - tabMargin - 1); TextRenderer.DrawText(e.Graphics, page.Text, thisFont, textRect, ForeColor, TextFormatFlags.EndEllipsis | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine | TextFormatFlags.NoPrefix); } if (path.PointCount > 0) { switch (owner.Navigator.Location) { case NavigatorLocation.Bottom: path.AddLine(Point.Round(path.GetLastPoint()), new Point(ClientRectangle.Right, drawPoint.Y)); break; case NavigatorLocation.Top: path.AddLine(Point.Round(path.GetLastPoint()), new Point(ClientRectangle.Right, TabHeight)); break; } e.Graphics.DrawPath(pathPen, path); } }
public PointF GetLastPoint() { return(gdiPath.GetLastPoint()); }