protected override void OnPaint(PaintEventArgs e) { if (Services == null) { Debug.Print("TextView.OnPaint: Services property must be set"); return; } GetStyleStack().PushStyle(StyleClass); var painter = new TextViewPainter(layout, e.Graphics, ForeColor, BackColor, Font, styleStack); painter.SetSelection(GetStartSelection(), GetEndSelection()); painter.PaintGdi(); GetStyleStack().PopStyle(); }