using System.Windows.Controls; using System.Windows.Forms.Integration; using Fibonacci; namespace WPFHost { /// <summary> /// Interaction logic for Page1.xaml /// </summary> public partial class Page1 : Page { private readonly MainForm mainForm = new MainForm(); public Page1() { InitializeComponent(); //Create a Windows Forms Host to host a form WindowsFormsHost windowsFormsHost = new WindowsFormsHost(); stackPanel.Width = mainForm.Width; stackPanel.Height = mainForm.Height; windowsFormsHost.Width = mainForm.Width; windowsFormsHost.Height = mainForm.Height; mainForm.TopLevel = false; windowsFormsHost.Child = mainForm; stackPanel.Children.Add(windowsFormsHost); } } }
Imports System.Windows.Controls Imports System.Windows.Forms.Integration Imports webtry2 Namespace WPFHost Partial Public Class Page1 Inherits Page 'Dim mainForm As webtry2.Form1 Private ReadOnly mainForm As webtry2.Form1 = New Form1 Public Sub New() 'InitializeComponent() Dim windowsFormsHost As WindowsFormsHost = New WindowsFormsHost() Dim stackPanel As StackPanel = New StackPanel stackPanel.Width = mainForm.Width stackPanel.Height = mainForm.Height windowsFormsHost.Width = mainForm.Width windowsFormsHost.Height = mainForm.Height mainForm.TopLevel = False windowsFormsHost.Child = mainForm stackPanel.Children.Add(windowsFormsHost) End Sub End Class End Namespace
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)