public static GraphicsPath GetArrowLinePath(float x1, float y1, float x2, float y2, bool include_arrow, float extra_thickness = 0) { var newPoints = GetArrowLinePoints(x1, y1, x2, y2, extra_thickness); var path = new GraphicsPath(FillMode.Winding); path.AddLines(newPoints.ToArray()); //if (include_arrow) // path.AddLines(GetArrowPoints(x2, y2, extra_thickness).ToArray()); //path.CloseFigure(); return path; }
private static Image LoadRightDoorTransparentPng(Size sz) { int w = sz.Width; int h = sz.Height; var path = new GraphicsPath(); path.AddLines(new[] { new Point(w / 2, 0), new Point(w, 0), new Point(w, h), new Point(w / 2, h), new Point(0, h / 2), }); // I will generate it by code but you should use Bitmap.FromFile(...) return(GenerateImage(path, sz)); }
void DrawItemRect(Graphics g, RectangleF rect) { float len = gradientSize; GraphicsPath myPath = new GraphicsPath();//建立GraphicsPath()类对象 PointF[] points1 = { new PointF(rect.Left, rect.Bottom), new PointF(rect.Left + len, rect.Top), new PointF(rect.Right - len - 1, rect.Top), new PointF(rect.Right - 1, rect.Bottom) }; PointF[] points2 = { new PointF(rect.Left, rect.Top), new PointF(rect.Left + len, rect.Bottom - 1), new PointF(rect.Right - len, rect.Bottom - 1), new PointF(rect.Right, rect.Top) }; PointF[] points; if (upOrBottom == 0) { points = points1; } else { points = points2; } myPath.AddLines(points); Pen pen = new Pen(itemBoxColor, 1.5f); System.Drawing.Brush brush = new SolidBrush(color); g.FillPath(brush, myPath); g.DrawPath(pen, myPath); }
public Wall(PointF coordinates, List <PointF> points = null) : base(coordinates) { name = "Wall"; graphicsPath = new GraphicsPath(); pen = new Pen(Color.FromArgb(255, Color.Black), brushDensity); transpPen = new Pen(Color.FromArgb(128, Color.Black), brushDensity); if (points == null) { path.Add(coordinates); Last = coordinates; } else { path = points; graphicsPath.AddLines(path.ToArray()); } }
private void btnUndo_Click(object sender, EventArgs e) { List <PointF> list = jogPath.PathData.Points.ToList <PointF>(); list.RemoveAt(list.Count - 1); rubberBand.Reset(); actualLine.Reset(); jogPath.Reset(); jogPath.AddLines(list.ToArray()); lastSet = toPoint(list[list.Count - 1]); if (jogPath.PointCount > 0) { rubberBand.AddLine(lastSet, posMoveTmp); } posMoveStart = posMoveTmp; posMoveEnd = posMoveStart; pictureBox1.Invalidate(); }
public override void Draw(Graphics g) { if (Rotation == 0) { g.DrawPath(pen, graphicsPath); } else { for (int i = 1; i < path.Count; i++) { path[i] = path[i].RotatePoint(path.First(), Rotation); } Rotation = 0; graphicsPath.Reset(); graphicsPath.AddLines(path.ToArray()); g.DrawPath(pen, graphicsPath); } }
/// <summary> /// RenderMultiLinestring /// Render a MultiLinestring to Graphics /// </summary> /// <param name="geo">SqlGeography geo</param> /// <param name="table">string layer table</param> /// <param name="g">Graphics used to draw to</param> /// <param name="id">int record id</param> /// <param name="valueFill">Color the stroke color style</param> private void RenderMultiLinestring(SqlGeography geo, string table, Graphics g, int id, Color valueFill) { if (geo.STNumGeometries() > 0) { totalPoints += (int)geo.STNumPoints(); for (int j = 1; j <= geo.STNumGeometries(); j++) { if (geo.STGeometryN(j).NumRings() > 0) { for (int k = 1; k <= geo.STGeometryN(j).NumRings(); k++) { if (geo.STGeometryN(j).RingN(k).STNumPoints() > 1) { Point[] ptArray = new Point[(int)geo.STNumPoints()]; double lon1 = 0.0; for (int m = 1; m <= geo.STGeometryN(j).RingN(k).STNumPoints(); m++) { double lat = (double)geo.STGeometryN(j).RingN(k).STPointN(m).Lat; double lon = (double)geo.STGeometryN(j).RingN(k).STPointN(m).Long; if (m > 1) { lon = HemisphereCorrection(lon, lon1, id); } LatLongToPixelXY(lat, lon, lvl, out pixelX, out pixelY); ptArray[m - 1] = new Point(pixelX - nwX, pixelY - nwY); lon1 = lon; } if (valueFill.Equals(Color.White)) { valueFill = ColorFromInt(LayerStyle[table].fill); } GraphicsPath linePath = new GraphicsPath(); linePath.AddLines(ptArray); Pen myPen = new Pen(valueFill); myPen.Width = 2; g.DrawPath(myPen, linePath); } } } } } }
protected void DrawTab(Graphics g, Int32 index, Font font, Brush textBrush, Pen blackPen, Pen whitePen) { Sheet sheet = Sheets[index]; Int32 height = this.ClientSize.Height; Point[] points = GetTabPoints(sheet); // tab background g.FillPolygon((index == this.SelectedIndex) ? SystemBrushes.Control : SystemBrushes.ControlDark, points); // left highlight line g.DrawLine((index == this.SelectedIndex) ? whitePen : SystemPens.Control, points[0].X + 1, points[0].Y, points[1].X + 1, points[1].Y); // tab frame GraphicsPath path = new GraphicsPath(); path.AddLines(points); g.DrawPath(blackPen, path); // tab name RectangleF rect = new RectangleF( sheet._X, 0, 9 + sheet._Margin + sheet._Width + sheet._Margin + 9, height ); StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; g.DrawString(sheet.Name, font, textBrush, rect, stringFormat); }
/// <summary> /// Рисует конус. /// </summary> public static void DrawCone ( [NotNull] Graphics g, Rectangle rect, int cap, [CanBeNull] Brush brush, [CanBeNull] Pen pen ) { using (GraphicsPath path = new GraphicsPath()) { path.AddLines(Points ( rect.Left, rect.Bottom, rect.Left + rect.Width / 2, rect.Top, rect.Right, rect.Bottom )); path.AddArc ( rect.Left, rect.Bottom - cap, rect.Width, cap * 2, 0, 180 ); if (!ReferenceEquals(brush, null)) { using (Region region = new Region(path)) { g.FillRegion(brush, region); } } if (!ReferenceEquals(pen, null)) { g.DrawPath(pen, path); } } }
public override void Draw(PaintEventArgs e, WEStyle style, string str) { Graphics g = e.Graphics; GraphicsPath path = new GraphicsPath(); if (PointCount == 0) { return; } foreach (var i in _Polygons) { if (i.PointCount == 0) { continue; } //foreach (var poi in ((WEPolygon)i).Points) //g.FillRectangle(new SolidBrush(style.FromColor), WEMapTools.FromMapPoint(poi).X - 2, WEMapTools.FromMapPoint(poi).Y - 2, 4, 4); GraphicsPath _path = new GraphicsPath(); List <PointF> temp = new List <PointF>(); foreach (var j in ((WEPolygon)i).Points) { temp.Add(WEMapTools.FromMapPoint(j)); } temp.Add(temp.First()); _path.AddLines(temp.ToArray()); /* * for (int j = 0; j < ((WEPolygon)i).Points.Length - 1; j++) * { * _path.AddLine(WEMapTools.FromMapPoint(((WEPolygon)i).Points[j]), WEMapTools.FromMapPoint(((WEPolygon)i).Points[j + 1])); * //g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), WEMapTools.FromMapPoint(((WEPolygon)i).Points[j]), WEMapTools.FromMapPoint(((WEPolygon)i).Points[j + 1])); * } * _path.AddLine(WEMapTools.FromMapPoint(((WEPolygon)i).Points.Last()), WEMapTools.FromMapPoint(((WEPolygon)i).Points.First())); * //g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), WEMapTools.FromMapPoint(((WEPolygon)i).Points.Last()), WEMapTools.FromMapPoint(((WEPolygon)i).Points.First())); */ path.AddPath(_path, false); } g.FillPath(new SolidBrush(style.FromColor), path); g.DrawPath(new Pen(new SolidBrush(style.BoundaryColor), (float)style.BoundaryWidth), path); //g.DrawString(str, new Font("微软雅黑", 8), new SolidBrush(Color.Black), WEMapTools.FromMapPoint(new WEPoint(MBR.MinX + MBR.Width / 2, MBR.MinY + MBR.Height / 2))); }
protected virtual void DrawBackground(Graphics g) { //SALVA HEIGHT E WIDTH PER CALCOLI PIU VELOCI int W = this.ClientRectangle.Width; int H = this.ClientRectangle.Height; //CREA IL PATH DELLA PARTE DA RIEMPIRE CON IL FILLCOLOR (INTERNA AL BORDO) GraphicsPath path = new GraphicsPath(); path.AddLines(new Point[] { new Point(1, 2), new Point(2, 1), new Point(3, 0), new Point(W - 3, 0), new Point(W - 2, 1), new Point(W - 1, 2), new Point(W - 1, H - 3), new Point(W - 2, H - 2), new Point(W - 3, H - 1), new Point(3, H - 1), new Point(2, H - 2), new Point(1, H - 3), new Point(1, 2) }); Region reg = new Region(path); //CREA LA REGION DA RIEMPIRE PARTENDO DAL PATH Color col = default(Color); if (this.Enabled) { col = this.FillColor; } else { col = Color.DarkGray; } using (SolidBrush fillbrush = new SolidBrush(col)) { g.FillRegion(fillbrush, reg); } }
/// <summary> /// Appends the specified polygon to the graphics path. /// </summary> private static void BuildPolygon(double[] vertices, ShapeRange shpx, GraphicsPath borderPath, MapArgs args, SoutherlandHodgman shClip) { double minX = args.MinX; double maxY = args.MaxY; double dx = args.Dx; double dy = args.Dy; for (int prt = 0; prt < shpx.Parts.Count; prt++) { PartRange prtx = shpx.Parts[prt]; int start = prtx.StartIndex; int end = prtx.EndIndex; List <double[]> points = new List <double[]>(); for (int i = start; i <= end; i++) { double[] pt = new double[2]; pt[X] = (vertices[i * 2] - minX) * dx; pt[Y] = (maxY - vertices[i * 2 + 1]) * dy; points.Add(pt); } if (null != shClip) { points = shClip.Clip(points); } List <Point> intPoints = DuplicationPreventer.Clean(points); if (intPoints.Count < 2) { points.Clear(); continue; } //Would be nice to figure out how to get rid of this lock lock (lock1) { borderPath.StartFigure(); Point[] pointArray = intPoints.ToArray(); borderPath.AddLines(pointArray); } points.Clear(); } }
protected override void CreateRegion() { int X = this.Width; int Y = this.Height; rects0 = new Rectangle[2]; rects0[0] = new Rectangle(2, 4, 2, Y - 8); rects0[1] = new Rectangle(X - 4, 4, 2, Y - 8); rects1 = new Rectangle[8]; rects1[0] = new Rectangle(2, 1, 2, 2); rects1[1] = new Rectangle(1, 2, 2, 2); rects1[2] = new Rectangle(X - 4, 1, 2, 2); rects1[3] = new Rectangle(X - 3, 2, 2, 2); rects1[4] = new Rectangle(2, Y - 3, 2, 2); rects1[5] = new Rectangle(1, Y - 4, 2, 2); rects1[6] = new Rectangle(X - 4, Y - 3, 2, 2); rects1[7] = new Rectangle(X - 3, Y - 4, 2, 2); Point[] points = { new Point(1, 0), new Point(X - 1, 0), new Point(X - 1, 1), new Point(X, 1), new Point(X, Y - 1), new Point(X - 1, Y - 1), new Point(X - 1, Y), new Point(1, Y), new Point(1, Y - 1), new Point(0, Y - 1), new Point(0, 1), new Point(1, 1) }; GraphicsPath path = new GraphicsPath(); path.AddLines(points); this.Region = new Region(path); base.CreateRegion(); }
void PaintCurves(Graphics g) { try { g.TranslateTransform(ClientRectangle.Width / 2, ClientRectangle.Height / 2); g.RotateTransform(rotation); foreach (var pi in plots) { var s = g.Save(); if (pi.XTranslate != 0 || pi.YTranslate != 0) { g.TranslateTransform(pi.XTranslate, pi.YTranslate); } g.RotateTransform(pi.Rotation); if (pi.Color != Color.Transparent) { g.DrawLines(pi.Pen, pi.Points); } if (pi.Brush != null) { GraphicsPath graphPath = new GraphicsPath(); graphPath.AddLines(pi.Points); //Brush b = new LinearGradientBrush(new Point(0, 0), new Point(100, 100), Color.Red, Color.Green); //PathGradientBrush pthGrBrush = new PathGradientBrush(graphPath); // Set the color at the center of the path to blue. //pthGrBrush.CenterColor = Color.FromArgb(255, 0, 0, 255); // Set the color along the entire boundary // of the path to aqua. //Color[] colors = { Color.FromArgb(255, 0, 255, 255) }; //pthGrBrush.SurroundColors = colors; g.FillPath(pi.Brush, graphPath); } g.Restore(s); } } catch (Exception) { MessageBox.Show("The given values are not all valid"); } }
protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) { var g = e.Graphics; const int ARROW_SIZE = 4; var arrowMiddle = new Point(e.ArrowRectangle.X + e.ArrowRectangle.Width / 2, e.ArrowRectangle.Y + e.ArrowRectangle.Height / 2); var arrowBrush = e.Item.Enabled ? SkinManager.GetPrimaryTextBrush() : SkinManager.GetDisabledOrHintBrush(); using (var arrowPath = new GraphicsPath()) { arrowPath.AddLines( new [] { new Point(arrowMiddle.X - ARROW_SIZE, arrowMiddle.Y - ARROW_SIZE), new Point(arrowMiddle.X, arrowMiddle.Y), new Point(arrowMiddle.X - ARROW_SIZE, arrowMiddle.Y + ARROW_SIZE) }); arrowPath.CloseFigure(); g.FillPath(arrowBrush, arrowPath); } }
private void pictureBox1_Paint(object sender, PaintEventArgs e) { if (wall) { using (Graphics gr = Graphics.FromImage(bitmap)) { gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; GraphicsPath pth = new GraphicsPath(); pth.AddLines(arr.ToArray()); gr.DrawPath(new Pen(Color.Black, 10), pth); using (Pen thick_pen = new Pen(Color.Black, 10)) { thick_pen.StartCap = thick_pen.EndCap = System.Drawing.Drawing2D.LineCap.Round; gr.DrawLine(thick_pen, arr.Last(), end); } } } }
public TriangleButton() { InitializeComponent(); this.FlatStyle = FlatStyle.Flat; this.CreateGraphics().DrawLine(Pens.Black, new Point(100, 100), new Point(200, 200)); this.Refresh(); GraphicsPath gp = new GraphicsPath(); List <PointF> arrPoints = new List <PointF>(); arrPoints.Add(new PointF(5, 15)); arrPoints.Add(new PointF(20, 15)); arrPoints.Add(new PointF(12.5F, 22.5f)); gp.AddLines(arrPoints.ToArray()); gp.CloseFigure(); this.CreateGraphics().DrawPath(Pens.Black, gp); Region r = new Region(gp); this.Region = r; this.BackColor = Color.RoyalBlue; }
//public FeatureSet LineFeatureSet //{ // get // { // return _featureSet; // } //} //public bool LineCanIn //{ // get; // set; //} #endregion #region Method protected override void OnDraw(MapDrawArgs e) { if (_isEnabled) { GraphicsPath gp = new GraphicsPath(); if (_points.Count >= 1) { gp.AddLines(_points.ToArray()); gp.AddLine(_points[(_points.Count - 1)], _currentPoint); } Pen pen = new Pen(Color.CadetBlue); pen.Width = 2; pen.StartCap = LineCap.Round; pen.EndCap = LineCap.Round; e.Graphics.DrawPath(pen, gp); } base.OnDraw(e); }
public SimsArrowLine(float x1, float y1, float x2, float y2, float x3, float y3) { _from = new PointF(x1, y1); _amid = new PointF(x2, y2); _to = new PointF(x3, y3); _pen = new Pen(Color.OrangeRed, 2); GraphicsPath capPath = new GraphicsPath(); capPath.AddLines(new Point[] { new Point(-3, -4), new Point(0, 0), new Point(3, -4) }); //_pen.StartCap = LineCap.SquareAnchor; //_pen.EndCap = LineCap.ArrowAnchor; _pen.CustomEndCap = new CustomLineCap(null, capPath); _focusPen = (Pen)_pen.Clone(); _focusPen.Color = Color.GreenYellow; // update draw path this.UpdateDrawPath(); }
public void Draw(Graphics g, bool isLine) { var points = Get2DPointFArr(); if (isLine) { g.DrawLines(new Pen(Color.Black, 2), points); } else { if (!cullBack) { GraphicsPath path = new GraphicsPath(); path.AddLines(points); int c = (int)(255 * dot); Brush br = new SolidBrush(Color.FromArgb(c, c, c)); g.FillPath(br, path); } } }
private CustomLineCap ArrowLineCap() { float num = 1f; GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddLines(new PointF[5] { new PointF(0f, 0f), new PointF(-1f * num, 0f), new PointF(0f, 3f * num), new PointF(1f * num, 0f), new PointF(0f, 0f) }); graphicsPath.CloseAllFigures(); CustomLineCap customLineCap = new CustomLineCap(null, graphicsPath, LineCap.ArrowAnchor); customLineCap.SetStrokeCaps(LineCap.Flat, LineCap.Flat); graphicsPath.Dispose(); return(customLineCap); }
/// <summary> /// Resets the border path. /// </summary> private void ResetBorderPath() { if (samplingImag == null) { m_borderPath = this.ClientRectangle.CreateRoundedRectanglePath(5); } else { var bit = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height); using (var bitg = Graphics.FromImage(bit)) { bitg.DrawImage(samplingImag, this.ClientRectangle, 0, 0, samplingImag.Width, samplingImag.Height, GraphicsUnit.Pixel); } _bitCache = bit; m_borderPath = new GraphicsPath(); List <PointF> lstPoints = GetBorderPoints(bit, transparent ?? samplingImag.GetPixel(0, 0)); m_borderPath.AddLines(lstPoints.ToArray()); m_borderPath.CloseAllFigures(); } }
/// ///////////////////////////////////////////////////////////////////// //Method: public static GraphicsPath MakePolyPath(double radius, int vertexCount, double variance) //Parameter: double radius- radius of the shape // int vertex count- the number of vertex for the shape // double variance- the change... //Return: GraphicsPath- the graphic path connected by all the points //Purpose: Generate a GraphicsPath from your collection of generated points and return i ///////////////////////////////////////////////////////////////////////// public static GraphicsPath MakePolyPath(double radius, int vertexCount, double variance) { Random rnd = new Random(); GraphicsPath gp = new GraphicsPath(); PointF[] myList = new PointF[vertexCount]; //find all the point aof the vertex for (int i = 0; i < vertexCount; i++) { myList[i] = (new PointF((float)((radius - rnd.NextDouble() * variance) * Math.Cos(2.0 * Math.PI * ((double)(i) / (double)(vertexCount)))), (float)((radius - rnd.NextDouble() * variance) * Math.Sin(2.0 * Math.PI * ((double)(i) / (double)(vertexCount)))) )); } gp.AddLine(myList[myList.Count() - 2], myList.Last()); gp.StartFigure(); gp.AddLines(myList); gp.CloseFigure(); return(gp); }
// ------------------------------ // protected // ------------------------------ protected override void PaintSelf(Graphics g) { // todo: GraphicsPathのリソースキャッシュ using (_ResourceCache.UseResource()) using (var path = new GraphicsPath()) { path.AddLines(EdgePoints.ToArray()); g.DrawPath(_PenResource, path); } if (_sourceDecoration != null) { _sourceDecoration.Target = new Line(First, FirstRef.Next.EdgePoint); _sourceDecoration.Paint(g); } if (_targetDecoration != null) { _targetDecoration.Target = new Line(Last, LastRef.Prev.EdgePoint); _targetDecoration.Paint(g); } }
// 绘制三角形到 2D窗口 public void Draw(Graphics g, bool isLine) { PointF[] lins = this.Get2DPointFArr(); if (isLine) { Pen pen = new Pen(Color.Green, 2); g.DrawLines(pen, lins); } else { if (!cullBack) { GraphicsPath path = new GraphicsPath(); path.AddLines(lins); int rgb = (int)(200 * dot) + 55; Brush brushes = new SolidBrush(Color.FromArgb(rgb, rgb, rgb)); g.FillPath(brushes, path); } } }
public void Draw(Graphics g, Color borderColor, Color?fillingColor) { using (GraphicsPath path = new GraphicsPath()) { path.AddLines(Points); if (fillingColor != null) { using (SolidBrush brush = new SolidBrush(fillingColor.Value)) { g.FillPath(brush, path); } } using (Pen pen = new Pen(borderColor)) { g.DrawPath(pen, path); } } }
// Token: 0x06000590 RID: 1424 RVA: 0x00024FE4 File Offset: 0x000233E4 protected override void OnPaint(PaintEventArgs e) { Graphics graphics = e.Graphics; graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; graphics.InterpolationMode = InterpolationMode.High; base.OnPaint(e); using (SolidBrush solidBrush = new SolidBrush(this.BackColor)) { graphics.FillRectangle(solidBrush, new Rectangle(0, 0, base.Width - 2, base.Height)); } bool @checked = base.Checked; if (@checked) { using (GraphicsPath graphicsPath = new GraphicsPath()) { graphicsPath.AddLines(new Point[] { new Point(2, base.Height / 2), new Point(base.Width / 3, base.Height - 3), new Point(base.Width - 2, base.Height / 3) }); using (Pen pen = new Pen(Color.White, 2f)) { graphics.DrawPath(pen, graphicsPath); } } } bool flag = !base.Enabled; if (flag) { using (SolidBrush solidBrush2 = new SolidBrush(Color.FromArgb(120, Color.Gray))) { graphics.FillRectangle(solidBrush2, 0, 0, base.Width, base.Height); } } }
void PictureBox1Paint(object sender, PaintEventArgs e) { //e.Graphics.DrawLine(Pens.Blue, axisMapping.ChannelValue, 0, 100, 50); const int padding = 30; int p, x, y; double val; var par = Parameters; var w = pictureBox.Width - 2 * padding; var h = pictureBox.Height - 2 * padding; GraphicsPath graphPath = new GraphicsPath(); List <Point> points = new List <Point>(); for (var i = 0; i <= w; i++) { p = (int)Math.Round(par.Min + (par.Max - par.Min) * (double)i / w); val = par.Transform(p); y = (int)Math.Round(padding + h - val * h); points.Add(new Point(padding + i, y)); } graphPath.AddLines(points.ToArray()); e.Graphics.DrawPath(linePen, graphPath); p = Math.Min(par.Max, Math.Max(par.Min, axisMapping.Input)); // clamp val = par.Transform(p); if (par.Max == par.Min) { x = padding + w / 2; } else { x = padding + (int)((double)(p - par.Min) / (par.Max - par.Min) * w); } y = padding + h - (int)(val * h); e.Graphics.DrawLine(inputPen, x, h + padding, x, y); e.Graphics.DrawLine(outputPen, padding, y, x, y); e.Graphics.DrawString(axisMapping.Input.ToString(), DefaultFont, Brushes.Green, x, h + padding); e.Graphics.DrawString(((int)(val * 100)).ToString() + "%", DefaultFont, Brushes.Red, 0, y); }
public void DrawLineString(LineString line, Pen pen) { if (IsStartDrawing == false) { return; } if (DrawBufferFlag == 0) { if (line.Vertices.Count > 1) { GraphicsPath gp = new GraphicsPath(); PointF[] v = new PointF[line.Vertices.Count]; for (int i = 0; i < line.Vertices.Count; i++) { v[i] = mDisplayTransformation.ToScreen(line.Vertices[i]); } gp.AddLines(LimitValues(v, extremeValueLimit)); if (mBitMapGc != null) { mBitMapGc.DrawPath(pen, gp); } } } else { if (line.Vertices.Count > 1) { GraphicsPath gp = new GraphicsPath(); PointF[] v = new PointF[line.Vertices.Count]; for (int i = 0; i < line.Vertices.Count; i++) { v[i] = mDisplayTransformation.ToScreen(line.Vertices[i]); } gp.AddLines(LimitValues(v, extremeValueLimit)); if (mDc != null) { mDc.DrawPath(pen, gp); } } } }
public void UpdateGraphicsPath() { if (graphicsPath == null) { graphicsPath = new GraphicsPath(); } else { graphicsPath.Reset(); } { if (LocalPoints.Count == 0) return; List<Point> pnts = new List<Point>(); var last = Point.Empty; for (int i = 0; i < LocalPoints.Count; i++) { Point p2 = new Point((int)LocalPoints[i].X, (int)LocalPoints[i].Y); if(p2 == last) continue; pnts.Add(p2); last = p2; } //close it pnts.Add(new Point((int) LocalPoints[LocalPoints.Count - 1].X, (int) LocalPoints[LocalPoints.Count - 1].Y)); if (pnts.Count > 2) { graphicsPath.AddPolygon(pnts.ToArray()); } else if (pnts.Count == 2) { graphicsPath.AddLines(pnts.ToArray()); } } }
public RearWallMesh ( float posX, float posY, float posZ, float width, float height, int textureID, float tilingX, float tilingY ) : base ( new Face[] { new RearWallFace(posX, posY, posZ, width, height, textureID, tilingX, tilingY), }, posX, posY, posZ, width, height, 0.0f ) { //specify the base as a GraphicsPath GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddLines ( new PointF[] { new PointF(1000 * posX, 1000 * posZ), new PointF(1000 * (posX + width), 1000 * posZ), new PointF(1000 * (posX + width), 1000 * (posZ + 0.001f)), new PointF(1000 * posX, 1000 * (posZ + 0.001f)), } ); insideRegion = new Region(graphicsPath); } //endconstruct
protected override GraphicsPath GetOutlinePath(int index) { Point[] pts = new Point[8](); if (Appearance == WeifenLuo.WinFormsUI.DockPane.AppearanceStyle.Document) { Rectangle rectTab = GetTabRectangle(index); rectTab.Intersect(TabsRectangle); int y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Bottom))).Y; Rectangle rectPaneClient = DockPane.ClientRectangle; pts[0] = DockPane.PointToScreen(new Point(rectPaneClient.Left, y)); pts[1] = PointToScreen(new Point(rectTab.Left, rectTab.Bottom)); pts[2] = PointToScreen(new Point(rectTab.Left, rectTab.Top)); pts[3] = PointToScreen(new Point(rectTab.Right + _DocumentTabOverlap, rectTab.Top)); pts[4] = PointToScreen(new Point(rectTab.Right + _DocumentTabOverlap, rectTab.Bottom)); pts[5] = DockPane.PointToScreen(new Point(rectPaneClient.Right, y)); pts[6] = DockPane.PointToScreen(new Point(rectPaneClient.Right, rectPaneClient.Bottom)); pts[7] = DockPane.PointToScreen(new Point(rectPaneClient.Left, rectPaneClient.Bottom)); } else { Rectangle rectTab = GetTabRectangle(index); rectTab.Intersect(TabsRectangle); int y = DockPane.PointToClient(PointToScreen(new Point(0, rectTab.Top))).Y + 1; Rectangle rectPaneClient = DockPane.ClientRectangle; pts[0] = DockPane.PointToScreen(new Point(rectPaneClient.Left, rectPaneClient.Top)); pts[1] = DockPane.PointToScreen(new Point(rectPaneClient.Right, rectPaneClient.Top)); pts[2] = DockPane.PointToScreen(new Point(rectPaneClient.Right, y)); pts[3] = PointToScreen(new Point(rectTab.Right + 1, rectTab.Top)); pts[4] = PointToScreen(new Point(rectTab.Right + 1, rectTab.Bottom)); pts[5] = PointToScreen(new Point(rectTab.Left + 1, rectTab.Bottom)); pts[6] = PointToScreen(new Point(rectTab.Left + 1, rectTab.Top)); pts[7] = DockPane.PointToScreen(new Point(rectPaneClient.Left, y)); } GraphicsPath path = new GraphicsPath(); path.AddLines(pts); return path; }