質問

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