简体   繁体   中英

WindowsFormsHost - Text Wrapping and Cut Off

This is my WindowsForm user control. It is using an Infragistics UltraGroupBox. 用户控制

When I try to host this control in a WPF Window and a WindowsFormsHost, the text "Integrated Security" suddenly wraps and is cut off. Also the "Select Type" text from another user control is cut off on the bottom (notice the y). 在此输入图像描述

How do I get my control not to wrap the text when hosted in a WindowsFormsHost since it fits fine (with some space) in the UserControl I'm using? Can anyone explain what is happening?

After reading the two posts that I linked to above, I was able to fix my issue by changing the FontFamily and FontSize. Now the font won't match all the other controls in my WPF Window, but the text doesn't wrap and get cut off.

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

The key changes are

  • FontFamily="Microsoft Sans Serif"
  • FontSize="11"

Text renders differently on WPF window and inside ElementHost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM