WPF Host on v5 vs v6 - wpf in v5 look weird


#1

Controls in v5 don’t look the same and whole UI is weirdly changed margins are off and things are in general smaller and not in position. Is there any remedy for that? @dale @nathanletwory


(Nathan 'jesterKing' Letwory) #2

I think @JohnM did the wpf host code.


(John Morse) #3

My guess is it is related to high dpi awareness, V5 is not at all good at it, there has been a lot of effort into high DPI awareness in V6. What are your DPI settings and are they the same for all of your displays? Rhino 6 is hight DPI aware but not per display DIP aware. You can run the TestDpiScale command in Rhino 6 to see what it is doing internally with regards to DPI scaling.


#4

Hmm… I never thought about that in this way im not dpi aware cause i thought WPF handles this on its own but here probably host sets own story. Its not unusable it is just distracting for me Thanks for clue ;).


#5

If anybody will have similar problem solution is weird indeed but works i found it on stackoverflow - https://stackoverflow.com/questions/4679172/text-renders-differently-on-wpf-window-and-inside-elementhost

Winform holder should have (i made in *.designer.cs):

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

and fontsize should be created again in form which holds element host:

  public MyForm()
  {
InitializeComponent();
this.Font = new System.Drawing.Font(
    "Segoe UI",
    9,
    System.Drawing.FontStyle.Regular,
    System.Drawing.GraphicsUnit.Point,
    ((byte)(0)));
  }

(Dale Fugier) #6

You may find this useful (too):

– Dale