Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (var backgroundImage = new Bitmap(backgroundPath))
- using (var avatarImage = new Bitmap(avatarPath))
- using (var myFont = new Font("myCustom", 8f))
- {
- Graphics canvas = Graphics.FromImage(backgroundImage);
- canvas.DrawImage(avatarImage, new Point(0, 0));
- canvas.DrawString(username, myFont,
- new SolidBrush(Color.Black), new PointF(5, 5));
- return new Bitmap(backgroundImage);
- }
- // 'PrivateFontCollection' is in the 'System.Drawing.Text' namespace
- var foo = new PrivateFontCollection();
- // Provide the path to the font on the filesystem
- foo.AddFontFile("...");
- var myCustomFont = new Font((FontFamily)foo.Families[0], 36f);
Add Comment
Please, Sign In to add comment