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(); } }
public override void Draw(System.Drawing.Graphics gr) { Brush brush = new SolidBrush(Color.Blue); PointF pos = Position; gr.FillEllipse(brush, pos.X -radius, pos.Y - radius, 2*radius, 2*radius); }
public override void Draw(System.Drawing.Graphics gr) { Brush brush = new SolidBrush(Color); PointF pos = GlobalPos; gr.FillEllipse(brush, pos.X - Radius, pos.Y - Radius, 2 * Radius, 2 * Radius); }
public override void draw(System.Drawing.Graphics g) { if (active) { g.FillEllipse(Brushes.Black, xCoord - 2f, yCoord - 2f, 4f, 4f); } }
public override void Draw(System.Drawing.Graphics g) { GraphicsState gs = g.Save(); PointF[] transformedPoints = this.getScreenBoundsInWorldCoordinates(g); g.DrawLine(axisPen, new PointF(base.Position.X, transformedPoints[0].Y), new PointF(base.Position.X, transformedPoints[1].Y)); g.DrawLine(axisPen, new PointF(transformedPoints[0].X, base.Position.Y), new PointF(transformedPoints[1].X, base.Position.Y)); #if DEBUG g.FillEllipse(Brushes.Maroon, base.Position.X, transformedPoints[0].Y, 10, 10); g.FillEllipse(Brushes.Maroon, base.Position.X, transformedPoints[1].Y, -10, -10); g.FillEllipse(Brushes.Maroon, transformedPoints[0].X, base.Position.Y, 10, 10); g.FillEllipse(Brushes.Maroon, transformedPoints[1].X, base.Position.Y, -10, -10); #endif g.Restore(gs); }
protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { try { string text = value == null ? "" : (string)value; Brush backColorBrush = new SolidBrush(cellStyle.BackColor); Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor); var col = this.OwningColumn as DataGridViewColorMarkColumn; Color markcolor = cellStyle.ForeColor; bool hasmark = col.GetColorMark(rowIndex, out markcolor); Brush markColorBrush = new SolidBrush(markcolor); base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground)); int rsz = this.DataGridView.RowTemplate.Height - 8; int dy = (cellBounds.Height - this.DataGridView.RowTemplate.Height) / 2; g.FillEllipse(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4 + dy, rsz, rsz); //g.FillRectangle(markColorBrush, cellBounds.X + 2, cellBounds.Y + 4, rsz, rsz); g.DrawString(text, cellStyle.Font, foreColorBrush, cellBounds.X + 4 + rsz, cellBounds.Y + 2 + dy); } catch (Exception e) { } }
protected override void OnPaint(System.Drawing.Graphics G) { G.DrawLine(Pens.Lime, this.Bounds.Left, this.Bounds.Top + this.Bounds.Height / 2, this.Bounds.Right - 1, this.Bounds.Top + this.Bounds.Height / 2); G.FillEllipse(Brushes.YellowGreen, this.Bounds.Left + (this.Value - this.MinValue) * this.Bounds.Width / (this.MaxValue - this.MinValue) - 10, this.Bounds.Top + (this.Bounds.Height - 10) / 2, 10, 10); base.OnPaint(G); }
/// <summary> /// 绘制方法 /// </summary> /// <param name="g"></param> /// <param name="center"></param> /// <param name="zoom"></param> /// <param name="screen_size"></param> public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { if (Points != null && Points.Count >= 2) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; List<Point> l = new List<Point>(); foreach (LatLngPoint p in Points) { l.Add(MapHelper.GetScreenLocationByLatLng(p, center, zoom, screen_size)); //屏幕坐标 } double total = 0; double step = 0; using (Pen pen = new Pen(Color.FromArgb(150, Color.OrangeRed), 4)) { for (int i = 0; i < l.Count - 1; ++i) { g.DrawLine(pen, l[i], l[i + 1]); g.FillEllipse(Brushes.White, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8))); g.DrawEllipse(Pens.OrangeRed, new Rectangle(new Point(l[i].X - 4, l[i].Y - 4), new Size(8, 8))); if (i == 0) //起点 { g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 35, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 35, 20)); g.DrawString("起点", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 6, l[i].Y + 2)); if (i == l.Count - 2) //终点 只有两点的时候 { step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 90, 20)); g.DrawString("总长:" + Math.Round(total,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2)); } } else //其它点 { step = MapHelper.GetDistanceByLatLng(Points[i-1], Points[i]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i].X + 3, l[i].Y, 70, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i].X + 3, l[i].Y, 70, 20)); g.DrawString(Math.Round(step,2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i].X + 10, l[i].Y + 2)); if (i == l.Count - 2) //终点 { step = MapHelper.GetDistanceByLatLng(Points[i], Points[i + 1]); total += step; g.FillRectangle(Brushes.White, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20)); g.DrawRectangle(Pens.DarkGray, new Rectangle(l[i + 1].X + 3, l[i + 1].Y, 100, 20)); g.DrawString("总长:" + Math.Round(total, 2) + "公里", new Font("微软雅黑", 9), Brushes.OrangeRed, new PointF(l[i + 1].X + 10, l[i + 1].Y + 2)); } } } } } }
public override void Draw(System.Drawing.Graphics gr) { Brush brush = new SolidBrush(Color.Yellow); gr.FillEllipse(brush, -radius, -radius, 2*radius, 2*radius); foreach ( Planet p in planets ) p.Draw( gr ); }
public void Draw(System.Drawing.Graphics g) { if (Screen.PrimaryScreen.Bounds.Contains(currentFixationLocation)) { int xPos = currentFixationLocation.X - DOTSIZE / 2; int yPos = currentFixationLocation.Y - DOTSIZE / 2; g.FillEllipse(Brushes.Gray, xPos, yPos, DOTSIZE, DOTSIZE); } }
public override void Draw(System.Drawing.Graphics g) { System.Drawing.SolidBrush solidBrush = new System.Drawing.SolidBrush(Color); System.Drawing.PointF upperLeftPoint = new System.Drawing.PointF((float)(Center.X - RadiusX), (float)(Center.Y - RadiusY)); System.Drawing.SizeF rectSize = new System.Drawing.SizeF((float)(2 * RadiusX), (float)(2 * RadiusY)); System.Drawing.RectangleF rect = new System.Drawing.RectangleF(upperLeftPoint, rectSize); g.FillEllipse(solidBrush, rect); solidBrush.Dispose(); }
public void DrawPoint(System.Drawing.Graphics graphics) { if (FillStartPoint != null) { graphics.FillEllipse(FILL_START_POINT_COLOR, FillStartPoint.X - FILL_START_POINT_RADIUS, FillStartPoint.Y - FILL_START_POINT_RADIUS, FILL_START_POINT_RADIUS * 2, FILL_START_POINT_RADIUS * 2); } }
public override void DibujarElemento(System.Drawing.Graphics grafico) { Pen p = new Pen(Color, 2); p.StartCap = LineCap.Triangle; int mitadX = _puerto.DimensionMundo.Centro.X; int mitadY = _puerto.DimensionMundo.Centro.Y; grafico.DrawLine(p, mitadX, mitadY, mitadX + 30, mitadY - 30); grafico.FillEllipse(new SolidBrush(Color), mitadX + 20, mitadY - 30, 10, 10); grafico.DrawString(Nombre, new Font("Arial", 8, FontStyle.Regular), Brushes.White, new PointF(mitadX + 30, mitadY - 30)); }
public override void DibujarElemento(System.Drawing.Graphics grafico) { Pen p = new Pen(Color, 2); p.StartCap = LineCap.Triangle; int mitadX = (_conexion.PosicionMundoPuerto1.X + _conexion.PosicionMundoPuerto2.X) / 2; int mitadY = (_conexion.PosicionMundoPuerto1.Y + _conexion.PosicionMundoPuerto2.Y) / 2; grafico.DrawLine(p, mitadX, mitadY, mitadX + 30, mitadY - 30); grafico.FillEllipse(new SolidBrush(Color), mitadX + 20, mitadY - 30, 10, 10); grafico.DrawString(Nombre, new Font("Arial", 8, FontStyle.Regular), Brushes.White, new PointF(mitadX + 30, mitadY - 30)); }
public override void Draw(System.Drawing.Graphics g, int panX, int panY) { int tempx1 = x1 - panX; int tempx2 = x2 - panX; int tempy1 = y1 - panY; int tempy2 = y2 - panY; if (needFilling) g.FillEllipse(filling, tempx1, tempy1, tempx2 - tempx1, tempy2 - tempy1); if (needOutline) g.DrawEllipse(outline, tempx1, tempy1, tempx2 - tempx1, tempy2 - tempy1); }
public override void Draw(System.Drawing.Graphics g) { Brush b = new SolidBrush(Color); if (Selected) { Pen pen = new Pen(Color.Yellow); g.DrawEllipse(pen, Position.X - radius, Position.Y - radius, radius * 2, radius * 2); pen.Dispose(); } g.FillEllipse(b, Position.X - radius, Position.Y - radius, radius * 2, radius * 2); b.Dispose(); }
public override void Paint(System.Drawing.Graphics g) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //the shadow g.FillEllipse(ArtPallet.ShadowBrush, Rectangle.X + 5, Rectangle.Y + 5, Rectangle.Width, Rectangle.Height); //the actual bundle g.FillEllipse(ShapeBrush,Rectangle); //the edge of the bundle if(Hovered || IsSelected) g.DrawEllipse(ArtPallet.HighlightPen,Rectangle); else g.DrawEllipse(ArtPallet.BlackPen, Rectangle); //the connectors for(int k=0;k<Connectors.Count;k++) { Connectors[k].Paint(g); } //here we keep it really simple: if(!string.IsNullOrEmpty(Text)) g.DrawString(Text, ArtPallet.DefaultFont, Brushes.Black, TextRectangle); }
public override void Draw(System.Drawing.Graphics g) { int Width = Points[0].X - Location.X; int Height = Points[0].Y - Location.Y; Rectangle drawArea = new Rectangle(Location.X, Location.Y, Width, Height); if (FillMode == FillMode.BorderAndFill || FillMode == FillMode.OnlyFill) { g.FillEllipse(UsedBrush, drawArea); } if (FillMode == FillMode.BorderAndFill || FillMode == FillMode.OnlyBorder) { g.DrawEllipse(UsedPen, drawArea); } }
public override void Draw(System.Drawing.Graphics g, System.Drawing.Pen pen, System.Drawing.Drawing2D.Matrix matrixValueToScreen, Rectangle2D graphRectangle, bool isLog) { using (Brush brush = new SolidBrush(pen.Color)) { PointF[] points = new PointF[] { this.Center }; this.Transform(matrixValueToScreen, isLog, points); if (graphRectangle.Contains(points[0])) { g.FillEllipse(brush, points[0].X - this.Size, points[0].Y - this.Size, this.Size * 2, this.Size * 2); } } }
public override void Paint(System.Drawing.Graphics g) { const int Size = 3; const double Radius = 5; const int Count = 3; for (int i = 0; i < Count; i++) { double rotation = _rotation + 2 * Math.PI / Count * i; int xRotation = (int)(Math.Cos(rotation) * Radius); int yRotation = (int)(Math.Sin(rotation) * Radius); g.FillEllipse(Brushes.AntiqueWhite, (int)Position.X - Size / 2 + xRotation, (int)Position.Y - Size / 2 + yRotation, Size, Size ); } }
/// <summary> /// Paints the shape on the canvas /// </summary> /// <param name="g"></param> public override void Paint(System.Drawing.Graphics g) { g.FillEllipse(shapeBrush,rectangle); if(hovered || isSelected) g.DrawEllipse(new Pen(Color.Red,2F),rectangle); else g.DrawEllipse(blackPen,rectangle); //well, a lot should be said here like //the fact that one should measure the text before drawing it, //resize the width and height if the text if bigger than the rectangle, //alignment can be set and changes the drawing as well... //here we keep it really simple: if(text !=string.Empty) g.DrawString(text,font,Brushes.Black, rectangle.X+10,rectangle.Y+10); }
/// <summary> /// 绘制方法 /// </summary> /// <param name="g">画布</param> /// <param name="center">地图中心</param> /// <param name="zoom">地图缩放级别</param> /// <param name="screen_size">地图大小</param> public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size) { g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Point theScreenCenter = MapHelper.GetScreenLocationByLatLng(Center, center, zoom, screen_size); //椭圆中心点的屏幕坐标 Point theScreenRightBottom = MapHelper.GetScreenLocationByLatLng(RightBottom, center, zoom, screen_size); //椭圆矩形任意一角的屏幕坐标 int width = Math.Abs(2 * (theScreenRightBottom.X - theScreenCenter.X)); int height = Math.Abs(2 * (theScreenRightBottom.Y - theScreenCenter.Y)); if (new Rectangle(new Point(0,0), screen_size).IntersectsWith(new Rectangle(theScreenCenter.X - width/2, theScreenCenter.Y - height/2, width, height))) //需要绘制 { using (SolidBrush sb = new SolidBrush(Color.FromArgb(30, Color.Blue))) { g.FillEllipse(sb, new Rectangle(theScreenCenter.X - width / 2, theScreenCenter.Y - height / 2, width, height)); } using (Pen pen = new Pen(Color.FromArgb(150,Color.Blue), 4)) { g.DrawEllipse(pen, new Rectangle(theScreenCenter.X - width / 2, theScreenCenter.Y - height / 2, width, height)); } } }
private void Draw(System.Drawing.Graphics canvas, List<Point> pointList) { float minX = pointList.Min(x => x.X), maxX = pointList.Max(x => x.X), minY = pointList.Min(x => x.Y), maxY = pointList.Max(x => x.Y); const int circleRadius = 4; var circleBrush = Brushes.BlueViolet; var linePen = new Pen(Color.Green, width: 2); var canvasPoints = new List<Point>(); foreach (var point in pointList) { var x = (int)(_frameWidthX + _canvasSize * ((point.X - minX) / (maxX - minX))); var y = (int)(_frameWidthY + _canvasSize * ((point.Y - minY) / (maxY - minY))); canvasPoints.Add(new Point(x, y)); } for (int i = 0; i < canvasPoints.Count; ++i) { canvas.FillEllipse(circleBrush, canvasPoints[i].X, canvasPoints[i].Y, circleRadius * 2, circleRadius * 2); canvas.DrawLine(linePen, new Point { X = canvasPoints[i].X + circleRadius, Y = canvasPoints[i].Y + circleRadius }, new Point { X = canvasPoints[(i + 1) % canvasPoints.Count].X + circleRadius, Y = canvasPoints[(i + 1) % canvasPoints.Count].Y + circleRadius }); } }
public void DrawSelected(System.Drawing.Graphics graphics, Rectangle bounds) { int x = bounds.X + (bounds.Width / 2); int y = bounds.Y + (bounds.Height / 2); if (mFill) { using (Brush b = new SolidBrush(mSelectionColour)) graphics.FillEllipse(b, x - mR, y - mR, mR * 2, mR * 2); } else using (Pen p = new Pen(mHoverColour)) graphics.DrawEllipse(p, x - mR, y - mR, mR * 2, mR * 2); }
/// <summary> /// 頂点を指定された Graphics に描画します。 /// </summary> /// <param name="g">Graphics</param> public void Draw(System.Drawing.Graphics g) { const float ADJUST_INDEX = 20.0f; const float ADJUST_RADIUS = 2.0f; Pen selectPen = new Pen(Color.Blue); selectPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; g.FillEllipse(new SolidBrush(VertexColor.GetVertexColor(color)), positionX - radius, positionY - radius, radius * 2.0f, radius * 2.0f); g.DrawEllipse(Pens.Black, positionX - radius, positionY - radius, radius * 2.0f, radius * 2.0f); if (canSeeIndex) g.DrawString(id.ToString(), new Font("MS UI Gothic", 18), Brushes.Black, positionX - radius - ADJUST_INDEX, positionY - radius - ADJUST_INDEX); if (isSelect || isOver) g.DrawEllipse(selectPen, positionX - radius - ADJUST_RADIUS, positionY - radius - ADJUST_RADIUS, radius * 2.0f + ADJUST_RADIUS * 2.0f, radius * 2.0f + ADJUST_RADIUS * 2.0f); }
public override void Draw(System.Drawing.Graphics g) { g.FillEllipse(GameSettings.ChargedColor, this.boundingBox); }
public override void Paint(System.Drawing.Graphics g) { /* Matrix or = g.Transform; Matrix m = new Matrix(); m.RotateAt(20, Rectangle.Location); g.MultiplyTransform(m, MatrixOrder.Append); */ g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed; //the shadow g.FillEllipse(ArtPallet.ShadowBrush, Rectangle.X + 8, Rectangle.Y + 8, Rectangle.Width, Rectangle.Height); //the actual bundle, //edit SM Shape color here Brush SMShapeBrush = new LinearGradientBrush(new Point(((int)(Rectangle.X)), ((int)(Rectangle.Y))), new Point(((int)(Rectangle.X + Rectangle.Width)), ((int)(Rectangle.Y))), Color.Wheat, Color.WhiteSmoke); g.FillEllipse(SMShapeBrush, Rectangle); //the edge of the bundle Pen SMPen = new Pen(Color.DarkViolet, 2.5F); SMPen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot; if (Hovered || IsSelected) { SMPen.Color = selectedColor; SMPen.Width = selectedWidth; g.DrawEllipse(SMPen, Rectangle); } else { g.DrawEllipse(SMPen, Rectangle); } //the connectors for(int k=0;k<Connectors.Count;k++) { Connectors[k].Paint(g); } //here we keep it really simple: if (!string.IsNullOrEmpty(Text)) { g.DrawString(Text, DDTTextFont, DDTTextBrush, Rectangle, DDTTextFormat); } }
/// <summary> /// Renders a point to the map. /// </summary> /// <param name="g">Graphics reference</param> /// <param name="point">Point to render</param> /// <param name="symbol">Symbol to place over point</param> /// <param name="symbolscale">The amount that the symbol should be scaled. A scale of '1' equals to no scaling</param> /// <param name="offset">Symbol offset af scale=1</param> /// <param name="rotation">Symbol rotation in degrees</param> /// <param name="map">Map reference</param> public static void DrawCircle(System.Drawing.Graphics g, SharpMap.Geometries.GISCircle circle, System.Drawing.Brush brush, System.Drawing.Pen pen, bool clip, SharpMap.Map map) { if (circle == null) return; double radius = circle.RadiusSexagecimal; SharpMap.Geometries.Point p = new SharpMap.Geometries.Point(circle.X - radius, circle.Y - radius); System.Drawing.PointF pp0 = SharpMap.Utilities.Transform.WorldtoMap(p, map); p.X = circle.X + radius; p.Y = circle.Y + radius; System.Drawing.PointF pp1 = SharpMap.Utilities.Transform.WorldtoMap(p, map); System.Drawing.Rectangle rect = new System.Drawing.Rectangle((int)pp0.X, (int)pp0.Y, (int)(pp1.X - pp0.X), (int)(pp1.Y - pp0.Y)); g.FillEllipse(brush, rect); g.DrawEllipse(pen, rect); pp1 = SharpMap.Utilities.Transform.WorldtoMap(circle, map); }
/// <summary> /// Fill an ellispe on the canvas /// </summary> /// <param name="canvas">The canvas in which an ellipse is filled</param> public void Fill(System.Drawing.Graphics canvas) { canvas.FillEllipse(m_style.fillingStyle, m_points[0].x, m_points[0].y, m_points[1].x - m_points[0].x, m_points[1].y - m_points[0].y); }
public override void Draw(System.Drawing.Graphics graphics) { Brush brush = new SolidBrush(Color); graphics.FillEllipse(brush, X - radius, Y - radius, 2 * radius, 2 * radius); }