/// <summary> /// Paints the fragment /// </summary> /// <param name="g">Device context to use</param> public void Paint(RGraphics g) { try { if (Display != CssConstants.None && Visibility == CssConstants.Visible) { // use initial clip to draw blocks with Position = fixed. I.e. ignrore page margins if (this.Position == CssConstants.Fixed) { g.SuspendClipping(); } // don't call paint if the rectangle of the box is not in visible rectangle bool visible = Rectangles.Count == 0; if (!visible) { var clip = g.GetClip(); var rect = ContainingBlock.ClientRectangle; rect.X -= 2; rect.Width += 2; if (!IsFixed) { //rect.Offset(new RPoint(-HtmlContainer.Location.X, -HtmlContainer.Location.Y)); rect.Offset(HtmlContainer.ScrollOffset); } clip.Intersect(rect); if (clip != RRect.Empty) visible = true; } if (visible) PaintImp(g); // Restore clips if (this.Position == CssConstants.Fixed) { g.ResumeClipping(); } } } catch (Exception ex) { HtmlContainer.ReportError(HtmlRenderErrorType.Paint, "Exception in box paint", ex); } }