WindowsFormsHost - 文本环绕和剪切

时间:2013-07-01 14:36:25

标签: .net wpf winforms infragistics

这是我的WindowsForm用户控件。它使用的是Infragistics UltraGroupBox。 User Control

当我尝试在WPF窗口和WindowsFormsHost中托管此控件时,文本“集成安全性”突然包装并被切断。此外,另一个用户控件的“选择类型”文本在底部被截断(注意y)。 enter image description here

如果在WindowsFormsHost中托管文本时如何让我的控件不包装文本,因为它在我正在使用的UserControl中适合(有一些空格)?谁能解释一下发生了什么?

1 个答案:

答案 0 :(得分:4)

在阅读了我上面链接的两篇帖子后,我能够通过更改FontFamily和FontSize来解决我的问题。现在,该字体将与我的WPF窗口中的所有其他控件不匹配,但文本不会换行并被切断。

<WindowsFormsHost FontFamily="Microsoft Sans Serif" FontSize="11" x:Name="MyHost" Margin="0,0,0,20" /> 

关键变化是

  • FontFamily =“Microsoft Sans Serif”
  • 字号= “11”

Text renders differently on WPF window and inside ElementHost