This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 8th, 2012  |  syntax: C#  |  size: 1.15 KB  |  views: 95  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System.Windows;
  2. using System.Windows.Input;
  3.  
  4. namespace WinFormWPFTest
  5. {
  6.     /// <summary>
  7.     /// Interaction logic for MainWindow.xaml
  8.     /// </summary>
  9.     public partial class MainWindow : Window
  10.     {
  11.         System.Windows.Forms.PictureBox pictureBox;
  12.         public MainWindow()
  13.         {
  14.             InitializeComponent();
  15.         }
  16.  
  17.         private void Grid_Loaded(object sender, RoutedEventArgs e)
  18.         {
  19.             System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
  20.             pictureBox = new System.Windows.Forms.PictureBox();
  21.             pictureBox.Anchor = System.Windows.Forms.AnchorStyles.Top;
  22.             pictureBox.Paint += new System.Windows.Forms.PaintEventHandler(pictureBox_Paint);
  23.             host.Child = pictureBox;
  24.             this.grid1.Children.Add(host);
  25.         }
  26.  
  27.         private void pictureBox_Paint(object sender, System.Windows.Forms.PaintEventArgs args)
  28.         {
  29.             ;
  30.         }
  31.  
  32.         private void grid1_MouseDown(object sender, MouseButtonEventArgs e)
  33.         {
  34.             pictureBox.Invalidate();
  35.         }
  36.     }
  37. }
clone this paste RAW Paste Data