在我的wpf應用程序中,我嘗試使用Windows窗體控件....但我遇到錯誤,例如 錯誤未找到類型「WindowsFormsHost」。驗證您是否缺少程序集引用,並且所有引用的程序集都已構建。 任何一個可以幫助我把它做...以下是我的代碼'WindowsFormsHost'未找到
c#:code
public Window2()
{
InitializeComponent();
System.Windows.Forms.PictureBox PictureBox1 = new System.Windows.Forms.PictureBox();
windowsFormsHost1.Child = PictureBox1;
PictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(PictureBox1_Paint);
}
xaml:code
<WindowsFormsHost Height="175" HorizontalAlignment="Left" Margin="10,10,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="255" />
您確定已經包含此'xmlns =「http://schemas.microsoft.com/winfx/2006/xaml/presentation」' 和'xmlns:x =「http://schemas.microsoft.com/ winfx/2006/xaml「' –
雅我添加了這些引用... – user3413736
你有使用'WindowsFormsIntegration' ref? – Rang