Question

I have following J# code

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

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

Thanks

Was it helpful?

Solution

try

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

see MSDN for further details.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top