/// <summary> /// Perform the layout of the html in the control. /// </summary> protected override Size MeasureOverride(Size constraint) { if (_htmlContainer != null) { using (var ig = new GraphicsAdapter()) { var horizontal = Padding.Left + Padding.Right + BorderThickness.Left + BorderThickness.Right; var vertical = Padding.Top + Padding.Bottom + BorderThickness.Top + BorderThickness.Bottom; var size = new Size(Math.Min(MaxWidth, constraint.Width), Math.Min(MaxHeight, constraint.Height)); var maxSize = new RSize(size.Width < Double.PositiveInfinity ? size.Width - horizontal : 0, size.Height < Double.PositiveInfinity ? size.Height - vertical : 0); _htmlContainer.HtmlContainerInt.MaxSize = maxSize; _htmlContainer.HtmlContainerInt.PerformLayout(ig); var newSize = _htmlContainer.ActualSize; constraint = new Size(newSize.Width + horizontal, newSize.Height + vertical); } } if (double.IsPositiveInfinity(constraint.Width) || double.IsPositiveInfinity(constraint.Height)) constraint = Size.Empty; return constraint; }
public override void MeasureString(string str, RFont font, double maxWidth, out int charFit, out double charFitWidth) { using (var g = new GraphicsAdapter()) { g.MeasureString(str, font, maxWidth, out charFit, out charFitWidth); } }
/// <summary> /// Render the html using the given device. /// </summary> /// <param name="g">the device to use to render</param> /// <param name="clip">the clip rectangle of the html container</param> public void PerformPaint(DrawingContext g, Rect clip) { ArgChecker.AssertArgNotNull(g, "g"); using (var ig = new GraphicsAdapter(g, Util.Convert(clip))) { _htmlContainerInt.PerformPaint(ig); } }
/// <summary> /// Measures the bounds of box and children, recursively. /// </summary> public void PerformLayout() { using (var ig = new GraphicsAdapter()) { _htmlContainerInt.PerformLayout(ig); } }