Home > Net >  Use the following code to draw grid distortion
Use the following code to draw grid distortion

Time:04-19

Using System;
using System.Collections.Generic;
Using System.Com ponentModel;
Using System. The Data;
Using System. Drawing;
Using System. Linq;
Using System. The Text;
Using System. The Threading. The Tasks;
Using System. Windows. Forms;
Using System. Drawing. Drawing2D;

The namespace WindowsFormsApp1
{
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent ();
}

Private void button1_Click (object sender, EventArgs e)
{

Graphics g=pictureBox1. CreateGraphics ();
Pen bluePen=new Pen (Color. Blue, 3);

for (int i=0; i {
;
G.D rawLine (bluePen, new Point (I, 0), new Point (I, enclosing pictureBox1, Height));
I +=60;
}

For (int j=0; J & lt; Enclosing pictureBox1. Height; J++)
{
G.D rawLine (bluePen, new Point (0, j), new Point (this. PictureBox1. Width, j));
J +=(enclosing pictureBox1. Height - 6)/10;
}

}
}
}

I feel how to draw the line in some places long, some places not aligned,
  •  Tags:  
  • C#
  • Related