直接上代码
方案一:
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
btn.Width = 800; btn.Height = 600;
System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel();
panel.AutoScroll = true; panel.AutoSize = true;
WindowsFormsHost winFormHost = new WindowsFormsHost();
winFormHost.Child = panel;
panel.Controls.Add(btn);
this.mydock.Content = winFormHost;
ElementHost elemHost = new ElementHost();
elemHost.AutoSize = true;
}
方案二:
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
<Canvs Title="File6.cml" x:Name="mydock">
<WindowsFormsHost>
<winform:Panel AutoScroll="True" AutoSize="True" x:Name="scrollPanel">
</winform:Panel>
</WindowsFormsHost>
</Canvs >
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
private void Window_Loaded(object sender, RoutedEventArgs e)
{
System.Windows.Forms.Button btn = new System.Windows.Forms.Button();
btn.Width = 800; btn.Height = 600;
scrollPanel.Controls.Add(btn);
}
更多参考http://fallingsun007.spaces.live.com/blog/cns!C1786539A5DA05CB!122.entry