I have following J# code

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

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

Thanks

有帮助吗?

解决方案

try

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

see MSDN for further details.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top