Usage with a ''Button'' C# with Example



Usage with a ''Button'' C# with Example

public static class Res 
{ 
///  
/// URL: https://www.behance.net/gallery/2846011/Manteka 
///  
public static FontFamily Maneteke = GetResourceFontFamily(Properties.Resources.manteka); 
public static FontFamily GetResourceFontFamily(byte[] fontbytes) 
{ 
PrivateFontCollection pfc = new PrivateFontCollection(); 
IntPtr fontMemPointer = Marshal.AllocCoTaskMem(fontbytes.Length); 
Marshal.Copy(fontbytes, 0, fontMemPointer, fontbytes.Length); 
pfc.AddMemoryFont(fontMemPointer, fontbytes.Length); 
Marshal.FreeCoTaskMem(fontMemPointer); 
return pfc.Families[0]; 
} 
} 
 

public class FlatButton : Button 
{ 
public FlatButton() : base() 
{ 
Font = new Font(Res.Maneteke, Font.Size); 
} 
protected override void OnFontChanged(EventArgs e) 
{ 
base.OnFontChanged(e); 
this.Font = new Font(Res.Maneteke, this.Font.Size); 
} 
} 
 

0 Comment's

Comment Form