c# - Winforms hosting WPF control and native wpf window look different -
when display wpf gui in native wpf window looks this
but when host in winfowms, looks this
wpf view code
<stackpanel> <stackpanel orientation="horizontal" > <textblock x:name="tb1">histogram intervals:</textblock> <textbox width="100"></textbox> </stackpanel> <stackpanel orientation="horizontal"> <textblock x:name="tb2" width="105">mistie threshold, m:</textblock> <textbox width="100" ></textbox> </stackpanel> </stackpanel> also, can see, there font render difference. how can solve these problems? updated: problem wpf native , wpf hosted inside winforms has different font. tb1 width changes in winforms, because not hard coded tb2, , depends on text render size.
bug happens because winforms set other font text in wpf control solved this, adding
fontfamily="segoe ui" fontsize="12" to usercontrol, hosted winforms.
these attributes force winform use fonts.


Comments
Post a Comment