c# - Byte Array to font from my solution resources folder -


i have specific font in resources folder want use.

label label; label.fontfamily=mynamespace.properties.resources. 

i can see font name return byte[]. how can use font ?

try function

private system.drawing.font getfontfromresource() {  stream fontstream = this.gettype().assembly.getmanifestresourcestream("yourfont.ttf");        byte[] fontdata = new byte[fontstream.length];       fontstream.read(fontdata,0,(int)fontstream.length);       fontstream.close();       unsafe       {         fixed(byte * pfontdata = fontdata)         {           return new  system.drawing.font((system.intptr)pfontdata, 16, fontstyle.regular);         }       } } 

how load resource assembly:(yournamespace.file.ttf): enter image description here


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -