public virtual Allocation Extents(double scale, Cairo.Context graphics) { Allocation alloc = d_allocation.Copy(); alloc.Scale(scale); alloc.GrowBorder(3); string lbl = Label; if (!String.IsNullOrEmpty(lbl)) { int width, height; MeasureString(graphics, lbl, out width, out height); alloc.Height += height + 3; if (width > alloc.Width) { int off = (int)(width - alloc.Width / 2); alloc.X -= off; alloc.Width += off * 2; } } d_lastExtents = alloc; return(d_lastExtents.Copy()); }
private void DrawStandalone(Cairo.Context graphics) { FromState(graphics, false); Allocation alloc = WrappedObject != null?WrappedObject.Allocation.Copy() : new Allocation(0, 0, 1, 1); alloc.X = 0; alloc.Y = 0; alloc.GrowBorder(-graphics.LineWidth); double radius = System.Math.Min(alloc.Width, alloc.Height) / 2; double cx = alloc.X + alloc.Width / 2; double cy = alloc.Y + alloc.Height / 2; double angle = System.Math.PI * 1.8; graphics.NewPath(); graphics.Arc(cx, cy, radius, 0, angle); graphics.Stroke(); DrawArrow(graphics, cx + radius * System.Math.Cos(angle), cy + radius * System.Math.Sin(angle), angle - System.Math.PI); }