- protected override void OnPaint(PaintEventArgs e)
- {
- base.OnPaint(e);
- e.Graphics.RotateTransform(_transAngle);
- e.Graphics.TranslateTransform(total_transformX , total_transformY );
- e.Graphics.ScaleTransform(_zoomSize, _zoomSize);
- //e.Graphics.TranslateTransform(total_transformX * _zoomSize - Bound.X * _zoomSize / 2, total_transformY * _zoomSize + Bound.Y * _zoomSize / 2);
- //
- //通过矩阵转化为笛卡尔坐标系。原点在左下方
- e.Graphics.MultiplyTransform(new System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, this.ClientSize.Height/_zoomSize - toolStripProgressBar1.Height/_zoomSize));
- try
- {
- sList.Draw(e.Graphics);
- }
- catch { }
- //scales
- e.Graphics.DrawLine(Pens.Red, new PointF(0, this.ClientRectangle.Location.Y *_zoomSize), new PointF(0, 1000));
- e.Graphics.DrawLine(Pens.Blue, new PointF(0, this.ClientRectangle.Location.Y *_zoomSize), new PointF(1000, this.ClientRectangle.Location.Y*_zoomSize));
- }
无论如何zoom,原点坐标不变
最新推荐文章于 2023-08-11 11:54:30 发布