0

我正在编写一个允许加载和显示几何图形的程序。最近,我添加了缩放功能。在低缩放级别下一切正常,但是当缩放级别增加(到大约 10,000)时,线条开始消失。在其他一些情况下,线条在一端很粗,在另一端很细。我用来画线的代码如下:

float edgeWidth = (float)(2/ scale);
Matrix tranf = new Matrix();
tranf.Scale((float)scale, (float)scale);
tranf.Translate(-offSet.X, -offSet.Y);
Graphics grp = displayArea.CreateGraphics();
grp.Transform = tranf;
grp.SmoothingMode = SmoothingMode.AntiAlias;
Pen pen = new Pen(Color.Red, edgeWidth);
grp.DrawLine(pen, (float)(tempShape.subPoly[i][j].X), (float)(tempShape.subPoly[i][j].Y),
                        (float)(tempShape.subPoly[i][(j + 1) % tempShape.subPoly[i].Count].X), (float)(tempShape.subPoly[i][(j + 1) % tempShape.subPoly[i].Count].Y))
4

0 回答 0