using System.Drawing; using System.Drawing.Drawing2D; public void Draw(Graphics graphics) { graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.DrawLine(Pens.Black, 10, 10, 100, 100); }In this example, we have created a Draw method that takes a Graphics object as a parameter. Then we have set the smoothing mode to AntiAlias using the SmoothingMode enumeration. Finally, we have drawn a straight line using the DrawLine method of the Pen class. This code example uses the System.Drawing and System.Drawing.Drawing2D namespaces from the core .NET framework.