This article describes the method of using GDI to draw straight lines in C#. Share it for your reference. The specific implementation method is as follows:
Point p1=new Point(200,200); Point p2=new Point(300,100); Pen p=new Pen(); Graphics g = CreateGraphics(); (p,p1,p2);
I hope this article will be helpful to everyone's C# programming.