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(); } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { base.OnRender(drawingContext); SolidColorBrush blackBrush = new SolidColorBrush(Color.FromRgb(0, 0, 0)); SolidColorBrush greenBrush = new SolidColorBrush(Color.FromRgb(0, 128, 0)); SolidColorBrush redBrush = new SolidColorBrush(Color.FromRgb(200, 0, 0)); Pen blackPen = new Pen(blackBrush, 1); Pen greenPen = new Pen(greenBrush, 1); Pen redPen = new Pen(redBrush, 1); drawingContext.DrawRectangle(null, blackPen, _size); if (Universe == null) return; foreach (FoodElement element in Universe.Food) { drawingContext.DrawEllipse(null, greenPen, new Point(element.CenterX, element.CenterY), element.Width, element.Width); } foreach (CreatureElement creature in Universe.Creatures) { drawingContext.DrawEllipse(null, redPen, new Point(creature.CenterX, creature.CenterY), creature.Width, creature.Width); } }
public override void paint(System.Drawing.Graphics g) { // threadName = Thread.CurrentThread.Name; try { //sleep thread based upon chosen speed Thread.Sleep(speed); //draw over object on screen in white g.DrawEllipse(new Pen(Color.White), xLoc, yLoc, width, height); //lock thread to update location lock (typeof(Thread)) { xLoc = xLoc + directionX; yLoc = yLoc + directionY; //check if it hits the edges of the screen checkEdgeCollision(); } //draw object in new location g.DrawEllipse(new Pen(color), xLoc, yLoc, width, height); } catch(Exception e ) { System.Console.WriteLine("Error in Thread Drawing" + e); } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius); }
public override void Paint(System.Drawing.Graphics g) { base.Paint(g); System.Drawing.RectangleF r1 = new System.Drawing.RectangleF(this.Rectangle.Location, new System.Drawing.SizeF(this.Rectangle.Width, this.Rectangle.Height * 3 / 5)); System.Drawing.RectangleF r2 = new System.Drawing.RectangleF(new PointF(this.Rectangle.X, this.Rectangle.Y + this.Height*2 / 5), new System.Drawing.SizeF(this.Width, this.Height * 3 / 5)); g.DrawEllipse(this.Pen, r1); g.DrawEllipse(this.Pen, r2); }
protected override void Draw(object sender, System.Windows.Media.DrawingContext g) { if (State == SelectionState.Shaping) { g.DrawLine(new Pen(Brushes.Gray, 1), shapeData.origin, currentPoint); g.DrawEllipse(Brushes.CornflowerBlue, new Pen(Brushes.DarkBlue, 1), shapeData.origin, 2, 2); g.DrawEllipse(Brushes.CornflowerBlue, new Pen(Brushes.DarkBlue, 1), currentPoint, 5, 5); } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); adornedElementRect.X += offsetX; adornedElementRect.Y += offsetY; SolidColorBrush renderBrush = new SolidColorBrush(Colors.LightGray); Pen renderPen = new Pen(new SolidColorBrush(Colors.Black), 1); double renderRadius = 3.0; drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius); }
protected override void OnRender(System.Windows.Media.DrawingContext dc) { base.OnRender(dc); foreach (var placement in Screen.Entities) { var entity = Screen.Stage.Project.EntityByName(placement.entity); if (entity != null) { var sprite = entity.DefaultSprite; if (sprite != null) { var frame = SpriteBitmapCache.GetOrLoadFrame(sprite.SheetPath.Absolute, sprite.CurrentFrame.SheetLocation); var flip = (placement.direction == Common.Direction.Left) ^ sprite.Reversed; int hx = flip ? sprite.Width - sprite.HotSpot.X : sprite.HotSpot.X; dc.DrawImage(frame, new Rect(this.Zoom * (placement.screenX - hx), this.Zoom * (placement.screenY - sprite.HotSpot.Y), this.Zoom * frame.PixelWidth, this.Zoom * frame.PixelHeight)); continue; } } dc.DrawEllipse(Brushes.Orange, null, new System.Windows.Point(this.Zoom * placement.screenX, this.Zoom * placement.screenY), 10 * Zoom, 10 * Zoom); } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { //base.OnRender(drawingContext); drawingContext.DrawEllipse(Brushes.Blue, new Pen(Brushes.Red, 24), new Point(RenderSize.Width / 2, RenderSize.Height / 2), RenderSize.Width / 2, RenderSize.Height / 2); }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { double penThickness = BorderBen.Thickness; Size effectiveRenderSize = new Size(this.RenderSize.Width - penThickness, this.RenderSize.Height - penThickness); //two possible scenarios //1) we are driven by width //2) we are driven by height //let's run both to see which works double circleDiameter; circleDiameter = (effectiveRenderSize.Width - (BlockCount - 1) * BlockMargin) / BlockCount; if (circleDiameter > effectiveRenderSize.Height) { circleDiameter = effectiveRenderSize.Height; } double startLeft = penThickness / 2 + effectiveRenderSize.Width - (this.BlockCount * circleDiameter + (this.BlockCount - 1) * BlockMargin); double startTop = penThickness / 2 + (effectiveRenderSize.Height - circleDiameter) / 2; double circleRadius = circleDiameter / 2; Point center = new Point(); int threshHold = BlockBarBase.GetThreshold(this.Value, this.BlockCount); Brush brushToUse; for (int i = 0; i < this.BlockCount; i++) { brushToUse = ((this.BlockCount - (i + 1)) < threshHold) ? Foreground : Background; center.X = startLeft + circleRadius; center.Y = startTop + circleRadius; drawingContext.DrawEllipse(brushToUse, BorderBen, center, circleRadius, circleRadius); startLeft += circleDiameter + BlockMargin; } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { Random r = new Random(); Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); Point stPt = new Point(adornedElementRect.X, adornedElementRect.Y); for (int x = 0; x < Number; x++) { Ellipse e = new Ellipse(); e.Width = 4; Brush b = new SolidColorBrush(new Color() { R =(byte) r.Next(0,255), G =(byte) r.Next(0,255),B =(byte) r.Next(0,255) }); Pen p = new Pen(Brushes.Black,1); int Rad = 3 ; drawingContext.DrawEllipse(b, p, stPt, Rad, Rad); stPt.X += (Rad * 2) + 1; if (stPt.X > adornedElementRect.Width) { stPt.X = 3; stPt.Y += 3; } } // Some arbitrary drawing implements. }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { foreach (MouseObject mo in MousePosition.Values) { if (mo.Key == 0) { drawingContext.DrawEllipse(Brushes.Transparent, Stroke1, new Point(mo.point.X, mo.point.Y), 10.0, 10.0); } else { drawingContext.DrawEllipse(Brushes.Transparent, Stroke2, new Point(mo.point.X, mo.point.Y), 10.0, 10.0); } } this.IsHitTestVisible = false; base.OnRender(drawingContext); }
/// <summary> /// Draws a circle with given raidus, coordinates Position.X & .Y /// using given color) /// </summary> /// <param name="g"></param> public override void Draw(System.Drawing.Graphics g) { //Create pen using (System.Drawing.Pen p = new System.Drawing.Pen(RgbColor)) { //draw an eclipse g.DrawEllipse(p, Position.X - Radius, Position.Y - Radius, Radius * 2, Radius * 2); } // pen is disposed }
public override void DrawSelOutline(System.Drawing.Graphics g, int panX, int panY) { int tempx1 = x1 - panX; int tempx2 = x2 - panX; int tempy1 = y1 - panY; int tempy2 = y2 - panY; g.DrawEllipse(selectionPen, tempx1, tempy1, tempx2 - tempx1, tempy2 - tempy1); }
/// <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) { 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 gc, Render.RenderParameter r, Render.RenderHint editState, Render.IDrawVisitor drawMethods, PointD mousePosition) { if (m_Param.Path != null) { /*if (editState.GetAttributes() == States.StateAttributes.Start) { if (r.StrokeFill != null) gc.FillPath(r.StrokeFill, (Tools.Model.VectorPath) m_Param.Path); gc.DrawPath(r.StrokeOutline, (Tools.Model.VectorPath)m_Param.Path); } else*/ if (editState == Render.RenderHint.Start) { Pen dashPen = (Pen)r.StrokeOutline.Clone(); dashPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; if (m_Param.Path.PointCount > 0) { PointD firstPoint = (PointD)m_Param.Path.GetFirstPoint(); gc.DrawEllipse(dashPen, (float)firstPoint.X - Tools.Render.DrawHelper.TARGET_SIZE / 2.0f, (float)firstPoint.Y - Tools.Render.DrawHelper.TARGET_SIZE / 2.0f, (float)Tools.Render.DrawHelper.TARGET_SIZE, (float)Tools.Render.DrawHelper.TARGET_SIZE); if (r.StrokeFill != null) gc.FillPath(r.StrokeFill, (Tools.Model.VectorPath)m_Param.Path); gc.DrawPath(r.StrokeOutline, (Tools.Model.VectorPath)m_Param.Path); DrawRegionRepresentation(gc, r, drawMethods, mousePosition); } } /*else if (editState.GetAttributes() == States.StateAttributes.Change) { drawMethods.DrawNegativeSpace(gc, m_Param, r); drawMethods.DrawPositiveSpace(gc, m_Param, r); if (editState is States.RegionChange) { DrawRegionRepresentation(gc, r, mousePosition); ((States.RegionChange)editState).Handles.DrawHandles(gc, m_Param, r); } }*/ else if (editState == Render.RenderHint.Feedback) { drawMethods.DrawNegativeSpace(gc, m_Param.Path.InternalPath, r); drawMethods.DrawPositiveSpace(gc, m_Param.Path.InternalPath, r); if (!(this is ConveyorBeltFilter)) DrawRegionRepresentation(gc, r,drawMethods, mousePosition); } else { drawMethods.DrawNegativeSpace(gc, m_Param.Path.InternalPath, r); drawMethods.DrawPositiveSpace(gc, m_Param.Path.InternalPath, r); DrawRegionRepresentation(gc, r, drawMethods, mousePosition); // TODO ((States.IFilterHandles)editState).Handles.DrawHandles(gc, m_Param, r); } drawMethods.DrawHandles(gc, this, r); } }
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, CoordinateFrame frame) { Point upperleft = frame.to_display((float)(circle.p.x - radius), (float)(circle.p.y - radius)); int size = (int)((radius * 2) / frame.scale); Rectangle r = new Rectangle(upperleft.X, upperleft.Y, size, size); if (disabled) g.DrawEllipse(EngineUtilities.YellowPen, r); else if (collide_last) g.DrawEllipse(EngineUtilities.RedPen, r); else if (corrected) g.DrawEllipse(EngineUtilities.YellowPen, r); else g.DrawEllipse(EngineUtilities.BluePen, r); Point loc = frame.to_display((float)circle.p.x, (float)circle.p.y); Point nextLoc = frame.to_display((float)nextBot.circle.p.x, (float)nextBot.circle.p.y); if (!firstBot) g.DrawLine(EngineUtilities.BluePen, loc, nextLoc); int sensCount = 0; foreach (ISensor sensor in sensors) { sensor.draw(g, frame); } if (display_debug) foreach (ISensor sensor in sensors) { if (draw_sensors) { double val = sensor.get_value(); if (val < 0.0) val = 0.0; if (val > 1.0) val = 1.0; Color col = Color.FromArgb((int)(val * 255), 0, 0); //(int)(val*255),(int)(val*255)); SolidBrush newpen = new SolidBrush(col); g.FillRectangle(newpen, sensCount * 40, 500 + 30 * id, 40, 30); sensCount += 1; } } }
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); } }
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext) { //double width = this.AdornedElement.DesiredSize.Width; //double height = this.AdornedElement.DesiredSize.Height; Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); SolidColorBrush renderBrush = new SolidColorBrush(Colors.Red); renderBrush.Opacity = 0.5; Pen renderPen = new Pen(new SolidColorBrush(Colors.White), 1.5); double renderRadius = 5.0; if (this.IsAboveElement) { drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius); } else { drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius); } }
public override void Paint(System.Drawing.Graphics g) { base.Paint(g); float f1 = Width * 2 / 3; System.Drawing.RectangleF r1 = new System.Drawing.RectangleF(this.Rectangle.Location, new System.Drawing.SizeF(f1, this.Rectangle.Height * 3 / 5)); System.Drawing.RectangleF r2 = new System.Drawing.RectangleF(new PointF(this.Rectangle.X, this.Rectangle.Y + this.Height * 2 / 5), new System.Drawing.SizeF(f1, this.Height * 3 / 5)); System.Drawing.RectangleF r3= new System.Drawing.RectangleF(new PointF(this.Rectangle.X+this.Width/3, this.Rectangle.Y + this.Height * 1 / 5), new System.Drawing.SizeF(f1, this.Height * 3 / 5)); GraphicsContainer gc = g.BeginContainer(Rectangle,Rectangle,GraphicsUnit.Pixel); g.SmoothingMode = SmoothingMode.HighQuality; g.Transform = GetTransForm(); g.DrawEllipse(this.Pen, r1); g.DrawEllipse(this.Pen, r2); g.DrawEllipse(this.Pen, r3); g.EndContainer(gc); }
public override void DrawSelection(System.Drawing.Graphics g) { Color selColor = Color.Red; int border = 3; Rectangle r = BaseElement.GetUnsignedRectangle( new Rectangle( el.Location.X - border, el.Location.Y - border, el.Size.Width + (border * 2), el.Size.Height + (border * 2))); HatchBrush brush = new HatchBrush(HatchStyle.SmallCheckerBoard, Color.LightGray, Color.Transparent); Pen p = new Pen(brush, border); g.DrawEllipse(p, r); p.Dispose(); brush.Dispose(); }
/// <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)); } } }
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); }
public override void drawSelf(System.Drawing.Graphics g) { g.DrawEllipse(p, x, y, radius, radius); }
private void draw_cursor_ring(System.Drawing.Graphics gfx, float cpx, float cpy) { float radius = 7; float outer_width = 3.0f; float inner_width = 1.5f; var outer_color = System.Drawing.Color.Black; var inner_color = System.Drawing.Color.White; var cursor_rect = new System.Drawing.RectangleF(cpx - radius, cpy - radius, radius * 2, radius * 2); using (var inner_pen = new System.Drawing.Pen(inner_color, inner_width)) using (var outer_pen = new System.Drawing.Pen(outer_color, outer_width)) { gfx.DrawEllipse(outer_pen, cursor_rect); gfx.DrawEllipse(inner_pen, cursor_rect); } }
public override void Drawing(System.Windows.Media.DrawingContext drawingContext, System.Windows.Rect area) { drawingContext.DrawEllipse(ShapeBrush, DrawPen, Position, Radius, Radius); }