使Wndows Form Host适应容器 [英] Fit Wndows Form Host to container

查看:67
本文介绍了使Wndows Form Host适应容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

更改表单大小时,我需要使WindowsFormsHost适应容器.我尝试了
使用下面的代码.但这行不通.

Hi All,

I need to fit WindowsFormsHost to container when form size change. I have try
with using below code. But It will not work.

<Border Grid.Row="4" Grid.ColumnSpan="1" Style="{StaticResource bStyle}">
         <WindowsFormsHost HorizontalAlignment="Stretch" 
         Name="FrmHostEmpAtt" VerticalAlignment="Stretch" Grid.ColumnSpan="1" 
                                  Focusable="False" IsManipulationEnabled="False"        Padding="2"
                                  ClipToBounds="True">
                    <rv:ReportViewer x:Name="RptEmpAttViwer"/>
                </WindowsFormsHost>
</Border>



请帮我
谢谢,
Chamara



Plese help me
Thanks,
Chamara

推荐答案



而不是使用Border,您应该将WindowsFormHost放置在Grid Control中,它将随窗口自动调整大小.另外,如果要将控件放在一行中,请尝试将 RowDefinition Height 保持为"*"

例如,在您的代码中,其行号为4.
Hi,

Rather than using Border, you should place the WindowsFormHost in the Grid Control which will automatically resize with the window. Also if you are placing the Control in a row then try to keep the Height of that RowDefinition to "*"

For example in your code its Row no 4.
<grid grid.row="4" grid.columnspan="1" style="{StaticResource bStyle}">
     <windowsformshost horizontalalignment="Stretch" name="FrmHostEmpAtt" verticalalignment="Stretch" grid.columnspan="1" focusable="False" ismanipulationenabled="False" padding="2" cliptobounds="True">
                    <rv:reportviewer x:name="RptEmpAttViwer" xmlns:x="#unknown" xmlns:rv="#unknown" />
     </windowsformshost>
</grid>



问候,
达山.



Regards,
Darshan.


这篇关于使Wndows Form Host适应容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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