/// <summary> /// Calculate the total area used by the backgound and the content, adding the background area to the content area. /// </summary> /// <param name="graphics"></param> /// <param name="contentSize"></param> /// <returns></returns> public SizeF GetExtent(MeasureHelper measure, SizeF contentSize) { if (Background is IBackground) { contentSize = ((IBackground)Background).GetBackgroundExtent(measure, contentSize); } if (Padding.IsEmpty == false) { contentSize = Padding.GetExtent(contentSize); } if (Border != null) { contentSize = Border.GetExtent(contentSize); } return(contentSize); }