用以下代码绘出的网格出现了畸变
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
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 < this.pictureBox1.Width; i++)
{
;
g.DrawLine(bluePen, new Point(i, 0), new Point(i, this.pictureBox1.Height));
i += 60;
}
for (int j = 0; j < this.pictureBox1.Height; j++)
{
g.DrawLine(bluePen, new Point(0, j), new Point(this.pictureBox1.Width, j));
j += (this.pictureBox1.Height - 6) / 10;
}
}
}
}
我怎么感觉画出的线在有些地方长了,有些地方没有对齐。