Search code examples
c#fontsdrawwin2d

Change font using Win2D drawtext


Does anyone know how to change the default font using win2d drawtext method? I need it to be a monospaced font like Courier New.

args.DrawingSession.DrawText("User : " + UNAME, 10, 350,Colors.White);


Solution

  • This was the answer I was looking for. I stumbled upon it earlier.

     args.DrawingSession.DrawText(Math.Round(percent * 100,1) + "%", Convert.ToSingle(pointX + 10), Convert.ToSingle(pointY), Color.FromArgb(255, 255, 255, 255), new CanvasTextFormat(){FontSize = 10 });
    
    
    **new CanvasTextFormat(){FontSize = 10 }**