在WPF中的其他控件下进行windowsformshost布局 [英] Make windowsformshost layout under other control in WPF

查看:723
本文介绍了在WPF中的其他控件下进行windowsformshost布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似以下文章的应用程序: WPF中的滑动面板 - 代码Scratcher [ ^ ]。主要创建一个在左侧面板展开时,面板左侧是WindowsFormsHost。如何将WindowsFormsHost设置为超过其他布局



我尝试过:



请告诉我解决问题的方法

解决方案

放置<$ c $边框控件中的c> WindowsFormHost :

 <   StackPanel     Panel.ZIndex   =  2   名称  =  pnlLeftMenu   方向  = 水平   高度  =  400     Horizo​​ntalAlignment   =    保证金  =   -  150,0,0,0 >  
< 边框 < span class =code-attribute> BorderBrush
= #AF1719 BorderThickness = 1 宽度 = 150 背景 = #4C808080 >
<! - 您的WindowsFormHost就在这里...... - >
< / Border >
< Grid >
< 按钮 名称 = btnLeftMenuHide 宽度 = 48 高度 = 48 点击 = btnLeftMenuHide_Click 内容 = 隐藏 可见性 = 隐藏 / >
< 按钮 名称 = btnLeftMenuShow 宽度 = < span class =code-keyword> 48 高度 = 48 单击 = btnLeftMenuShow_Click 内容 = 显示 / >
< / Grid >
< / StackPanel >


I have a application like following article : Sliding Panel in WPF - Code Scratcher[^] .In main I create a in center position .when left panel is expanded ,panel left is under WindowsFormsHost.How to set WindowsFormsHost to over other lay out

What I have tried:

Please tell me any solution for my problem

解决方案

Place your WindowsFormHost inside the Border control:

<StackPanel Panel.ZIndex="2" Name="pnlLeftMenu" Orientation="Horizontal" Height="400" HorizontalAlignment="Left" Margin="-150,0,0,0">
	<Border BorderBrush="#AF1719" BorderThickness="1" Width="150" Background="#4C808080" >
	    <!-- Your WindowsFormHost goes here... -->
	</Border>
	<Grid>
		<Button Name="btnLeftMenuHide" Width="48" Height="48" Click="btnLeftMenuHide_Click" Content="Hide" Visibility="Hidden"/>
		<Button Name="btnLeftMenuShow" Width="48" Height="48" Click="btnLeftMenuShow_Click" Content="Show"/>
	</Grid>
</StackPanel>


这篇关于在WPF中的其他控件下进行windowsformshost布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆