public GraphicRect Center(Func <GraphicRect, GraphicRect> operation) { var newG = new CenterGraphicRect(g, r, b, p, f, sf, leftOffset, topOffset); var calculateCenter = (CenterGraphicRect)operation(newG); var width = calculateCenter.Width; var currentCenterPoint = r.Left + r.Width / 2; var newRect = new Rectangle(currentCenterPoint - width / 2, r.Top, width, r.Height); var centeredGr = new GraphicRect(g, newRect, b, p, f, sf, leftOffset, topOffset); operation(centeredGr).ToBelow(); return(this); }
public GraphicRect Center(Func<GraphicRect, GraphicRect> operation) { var newG = new CenterGraphicRect(g, r, b, p, f, sf, leftOffset, topOffset); var calculateCenter = (CenterGraphicRect)operation(newG); var width = calculateCenter.Width; var currentCenterPoint = r.Left + r.Width / 2; var newRect = new Rectangle(currentCenterPoint - width/2, r.Top, width, r.Height); var centeredGr = new GraphicRect(g, newRect, b, p, f, sf, leftOffset, topOffset ); operation(centeredGr).ToBelow(); return this; }