using System.Windows; using System.Windows.Input; namespace WinFormWPFTest { /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { System.Windows.Forms.PictureBox pictureBox; public MainWindow() { InitializeComponent(); } private void Grid_Loaded(object sender, RoutedEventArgs e) { System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); pictureBox = new System.Windows.Forms.PictureBox(); pictureBox.Anchor = System.Windows.Forms.AnchorStyles.Top; pictureBox.Paint += new System.Windows.Forms.PaintEventHandler(pictureBox_Paint); host.Child = pictureBox; this.grid1.Children.Add(host); } private void pictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs args) { ; } private void grid1_MouseDown(object sender, MouseButtonEventArgs e) { pictureBox.Invalidate(); } } }