Domanda

I have following J# code

bigFont = new Font("Arial", bigFontSize, FontSize.PIXELS);

How I can convert above line to c# FontSize.PIXELS equivalent.

Thanks

È stato utile?

Soluzione

try

Font bigFont = new Font("Arial", bigFontSize, GraphicsUnit.Pixel);

see MSDN for further details.

Altri suggerimenti

You can use the GraphicsUnit.Pixel on the contstructor:

Font f = new Font("Arial", 25, GraphicsUnit.Pixel);
this.Font = f;

It looks like you're using this constructor for the Font, taking a font-family, an emSize, and a graphics unit.

In that case, you want a GraphicsUnit enumeration.

And it looks like the specific equivalent you want is System.Drawing.GraphicsUnit.Pixel.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top