Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将用户控件添加到选项卡控件页面,以及如何使用c#winforms在单击按钮时打开整个选项卡控件?_C#_.net_Winforms - Fatal编程技术网

如何将用户控件添加到选项卡控件页面,以及如何使用c#winforms在单击按钮时打开整个选项卡控件?

如何将用户控件添加到选项卡控件页面,以及如何使用c#winforms在单击按钮时打开整个选项卡控件?,c#,.net,winforms,C#,.net,Winforms,如何在winforms中将用户控件添加到选项卡控件,以及如何单击一个按钮打开整个选项卡控件面板?编辑问题之前: 使用System.Windows.Forms.Integration.Elementhost。 请发布您目前尝试的代码。或者,您知道,只需发布面板即可。这是执行类似操作的常用控件。@nyrguds您不能创建面板宿主WPF或使用Xaml代码。@shad0wk是问题中指定的吗?它被标记为winforms,而不是WPF。 // Create the ElementHost control

如何在winforms中将用户控件添加到选项卡控件,以及如何单击一个按钮打开整个选项卡控件面板?

编辑问题之前:

使用
System.Windows.Forms.Integration.Elementhost


请发布您目前尝试的代码。或者,您知道,只需发布面板即可。这是执行类似操作的常用控件。@nyrguds您不能创建
面板
宿主WPF或使用Xaml代码。@shad0wk是问题中指定的吗?它被标记为winforms,而不是WPF。
// 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);