ITeye博客

WindowsFormsHost的使用注意

jcair · 2016-04-25 10:24 · wpf学习 · 编程语言 · Markdown

一使用 1 引用 2 xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms" 3 由于WindowsFormsHost会指定需要用 wfi:WindowsFormsHost wfi:ElementHost <.................> </wfi:ElementHost> </wfi:WindowsFormsHost> 包裹,且在最外层包裹 <Grid.RowDefinitions> </Grid.RowDefinitions> <wfi:WindowsFormsHost Name="ConditionOrderEditWindowsFormsHost" MouseDown="WindowsFormsHost_MouseDown"> 二 WindowsFormsHost鼠标事件响应 1 里面的控件可以响应,若使用Forms的控件注意使用System.Windows.Forms.MouseEventArgs <wfi:WindowsFormsHost Width="80"> <wf:Button MouseDown="Button_MouseDown"/> </wfi:WindowsFormsHost> private void Button_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { int i = 0; } 2 WindowsFormsHost上无法响应需要使用WinPro 3 使用鼠标事件时需注意顶层是否可以获得鼠标事件

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。