public override void Draw(Cairo.Context dc) { if (TheFill != null) { dc.FillEllipse(BB); //TheFill, } if (ThePen != null) { dc.DrawEllipse(BB); //ThePen, } }
public override void Draw(Cairo.Context dc) { Pen p = IsSelected ? SelPen : StdPen; Rect lBB = GetBB(Parent.Height); // draw lines if (L1Visible) { dc.DrawLine(L1Origin, lBB.Center()); //DashedPen, } if (L2Visible) { dc.DrawLine(L2Origin, lBB.Center()); //DashedPen, } // draw CP dc.FillEllipse(lBB); //Brushes.Gray, dc.DrawEllipse(lBB); //p, }
protected override bool OnExposeEvent(Gdk.EventExpose ev) { base.OnExposeEvent(ev); using (Cairo.Context g = CairoHelper.Create(GdkWindow)) { Cairo.Rectangle ourRect = Rectangle.Inflate(GdkWindow.GetBounds(), -1, -1).ToCairoRectangle(); double diameter = Math.Min(ourRect.Width, ourRect.Height); double radius = (diameter / 2.0); Cairo.PointD center = new Cairo.PointD( (float)(ourRect.X + radius), (float)(ourRect.Y + radius)); double theta = (this.angleValue * 2.0 * Math.PI) / 360.0; Cairo.Rectangle ellipseRect = new Cairo.Rectangle(ourRect.Location(), diameter, diameter); Cairo.Rectangle ellipseOutlineRect = ellipseRect; g.DrawEllipse(ellipseOutlineRect, new Cairo.Color(.1, .1, .1), 1); double endPointRadius = radius - 2; Cairo.PointD endPoint = new Cairo.PointD( (float)(center.X + (endPointRadius * Math.Cos(theta))), (float)(center.Y - (endPointRadius * Math.Sin(theta)))); float gripSize = 2.5f; Cairo.Rectangle gripEllipseRect = new Cairo.Rectangle(center.X - gripSize, center.Y - gripSize, gripSize * 2, gripSize * 2); g.FillEllipse(gripEllipseRect, new Cairo.Color(.1, .1, .1)); g.DrawLine(center, endPoint, new Cairo.Color(.1, .1, .1), 1); } return(true); }
public static void FillEllipse(this Cairo.Context dc, System.Windows.Rect r) { dc.FillEllipse(r.Center().X, r.Center().Y, r.Width, r.Height); }