如何将用户控件添加到选项卡控制页面以及如何使用C#Winforms单击按钮打开整个选项卡控件



如何将用户控件添加到winform中的选项卡控制以及如何在单个按钮上打开整个选项卡控制面板?

在编辑问题之前:

使用System.Windows.Forms.Integration.Elementhost。MSDN。

// Create the ElementHost control to host the WPF UserControl.
ElementHost WPFHost = new ElementHost();
WPFHost.Dock = DockStyle.Fill;
// Create the WPF UserControl.
HostingWpfUserControlInWf.UserControl1 uc = new HostingWpfUserControlInWf.UserControl1();
// Add the WPF UserControl to the Host.
WPFHost.Child = uc;
// Add the ElementHost to the form.
this.Controls.Add(WPFHost);

或者您可以使用XAML设计Winform Project GUI

最新更新