Painting on PDFViewWPF

54 views
Skip to first unread message

David

unread,
May 23, 2012, 3:57:39 AM5/23/12
to pdfne...@googlegroups.com

I try to paint in my WPF PDF viewer.

If no PDF is loaded, this works. 


When i opened a file, the painted things are not longer visible.

I would like that my red rectangle drawn (and displayed), even if a file is opened.
That's my OnRender Method, what i'm doing wrong?

public class PDFView : PDFViewWPF
{
// ...

#region Drawing

protected override void OnRender(DrawingContext drawingContext)
{
  Trace.WriteLine("PDFView: OnRender");

  base.OnRender(drawingContext);

  drawingContext.DrawRectangle(Brushes.Red, new Pen(Brushes.Black, 0), new System.Windows.Rect(150, 150, 100, 100));
}

#endregion Drawing

// ...
 }



Support

unread,
May 23, 2012, 11:58:01 AM5/23/12
to pdfne...@googlegroups.com
 
 

The answer is given by Chales Petzold here.

His answer is 'don't know why', however a comment correctly suggests that setting the window's Background to transparent fixes the bug.

It is possible that Grid generates this problem. Default Window contains a Grid element.

Support

unread,
May 23, 2012, 11:59:50 AM5/23/12
to pdfne...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages