我需要绘制一个带有Graphics
类的网格(只是交叉线),以及像这张图片这样的透明表示:
除了绘制每条线/矩形之外,我不知道任何其他方式。如果领域很宽,性能会很差。有没有更好的方法来绘制这些东西?
这是我当前绘制网格的代码:
private void drawGrid(Graphics pGraphic, int pGridSize)
{
int verticalCount = this.mPicScreen.Width / pGridSize + 1;
int horizontalCount = this.mPicScreen.Height / pGridSize + 1;
Pen p = new Pen(Color.Gray);
// Vertical Lines
for (int i = 0; i < verticalCount; i++)
{
pGraphic.DrawLine(p,
new Point(i * pGridSize, 0),
new Point(i * pGridSize, this.mPicScreen.Height));
}
// Horizontal Lines
for (int i = 0; i < horizontalCount; i++)
{
pGraphic.DrawLine(p,
new Point(0, i * pGridSize),
new Point(this.mPicScreen.Width, i * pGridSize));
}
}