Draw on top of Windows Forms control

126 views Asked by At

For my current project, I am required to display a PDF, and then draw on top of it. I am using Adobe Reader as a PDF viewer, as this can be hosted in a Windows Forms control which can in turn be hosted in a WPF application. However, I cannot draw over this control.

There seem to be a couple of approaches to solving this problem out there, but for the life of me I cannot seem to find a good example of a generic solution that would fit into my existing code. The most common solution I can see are Adorner/Layer/Decorators, but I can't find a way to get them into my XAML in a way that won't break the application.

My current XAML is as follows:

<Window x:Class="ThisProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ThisProject"
    Title="MainWindow" Height="768" Width="1366"  
    WindowState="Maximized" WindowStyle="None" KeyDown="WindowKeyDown"
    Loaded="WindowLoaded">
    <Grid Name="PDFGrid">
        <local:PDFViewerHost x:Name="PdfViewer"/>
    </Grid>
</Window>

What I will need to go on top of the PDF viewer is a bunch of shapes, defined at runtime. Any suggestions as to a method that will allow me to stick those shapes on top of it would be greatly appreciated.

Thanks!

0

There are 0 answers