public void SetBlockLocation(double locationX, double alignmentCenterY, double rowY) { var rootindexSize = GetRootIndexSize(); double rootIndexY = alignmentCenterY - GetVerticalAlignmentCenter(); this.Location = new Point(locationX, rootIndexY); if (null != RootIndex) { RootIndex.Location = new Point(locationX, rootIndexY); var rootIndexVerticalCenter = RootIndex.GetVerticalAlignmentCenter(); RootIndex.SetBlockLocation(locationX, RootIndex.Location.Y + rootIndexVerticalCenter, rowY); } if (null != Radicand) { Radicand.Location = new Point(locationX + rootindexSize.Width + 10, this.Location.Y + rootindexSize.Height / 3); double radicandVerticalCenter = Radicand.GetVerticalAlignmentCenter(); Radicand.SetBlockLocation(Radicand.Location.X, Radicand.Location.Y + radicandVerticalCenter, rowY); } }
public double GetVerticalAlignmentCenter() { Size rootIndexSize; if (null == RootIndex) { rootIndexSize = new Size(12, FontManager.Instance.FontSize); } else { rootIndexSize = RootIndex.GetSize(); } if (null == Radicand) { return(FontManager.Instance.FontSize / 2 + rootIndexSize.Height / 3); } else { double verticalCenter = Radicand.GetVerticalAlignmentCenter(); return(verticalCenter + rootIndexSize.Height / 3); } }