using Microsoft.Graphics.Canvas; using Microsoft.Graphics.Canvas.UI.Xaml; private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args) { // Create a CanvasDrawingSession object CanvasDrawingSession drawSession = args.DrawingSession; // Draw a circle drawSession.DrawCircle(100, 100, 50, Colors.Red); }
private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args) { // Create a CanvasDrawingSession object CanvasDrawingSession drawSession = args.DrawingSession; // Draw multiple circles using a for loop for (int i = 0; i < 5; i++) { drawSession.DrawCircle(50 + (i * 30), 100, 20, Colors.Blue); } }In this example, a for loop is used to draw 5 blue circles at different points along the x-axis. The package library used in these examples is the Win2D package, which is a Windows Runtime API for immediate mode 2D graphics rendering.