点击菜单后 生成图形,闪了一下就什么都没了,怎么个情况?Graphics dc = this.pnGrid.CreateGraphics();
dc.TranslateTransform(this.pnGrid.AutoScrollPosition.X, this.pnGrid.AutoScrollPosition.Y); //文档到设备区的坐标变换
this.pnGrid.AutoScrollMinSize = new Size(grdFileInfo.rowsNum, grdFileInfo.cloumnsNum); Pen gridPen = new Pen(Color.Black, 1);
for (int x = 0; x < grdFileInfo.cloumnsNum; x += 50)
{
for (int y = 0; y < grdFileInfo.rowsNum; y += 50)
{
Point tempTop = new Point(x, y - 3);
Point tempBottom = new Point(x, y + 3);
Point tempLeft = new Point(x - 3, y);
Point tempRight = new Point(x + 3, y); dc.DrawLine(gridPen, tempTop, tempBottom);
dc.DrawLine(gridPen, tempLeft, tempRight);
}
}
dc.TranslateTransform(this.pnGrid.AutoScrollPosition.X, this.pnGrid.AutoScrollPosition.Y); //文档到设备区的坐标变换
this.pnGrid.AutoScrollMinSize = new Size(grdFileInfo.rowsNum, grdFileInfo.cloumnsNum); Pen gridPen = new Pen(Color.Black, 1);
for (int x = 0; x < grdFileInfo.cloumnsNum; x += 50)
{
for (int y = 0; y < grdFileInfo.rowsNum; y += 50)
{
Point tempTop = new Point(x, y - 3);
Point tempBottom = new Point(x, y + 3);
Point tempLeft = new Point(x - 3, y);
Point tempRight = new Point(x + 3, y); dc.DrawLine(gridPen, tempTop, tempBottom);
dc.DrawLine(gridPen, tempLeft, tempRight);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货