|
楼主 |
发表于 2014-6-5 13:56:43
|
显示全部楼层
下面是绘制网格代码,
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
drawGrids(e);
}
private void pictureBox2_Paint(object sender, PaintEventArgs e)
{
drawGrids(e);
}
//画网格
private void drawGrids(PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen myPen = Pens.Green;
for (int i = 0; i < pictureBox1.Width; i++)
{
g.DrawLine(myPen, new Point(i, 0), new Point(i, pictureBox1.Bottom));
i += pictureBox1.Width / 10;
}
for (int j = 0; j < pictureBox1.Height; j++)
{
g.DrawLine(myPen, new Point(0, j), new Point(pictureBox1.Right, j));
j += pictureBox1.Height / 10;
}
}
|
|