无论如何zoom,原点坐标不变

 
  1. protected override void OnPaint(PaintEventArgs e)
  2.         {
  3.             base.OnPaint(e);
  4.             e.Graphics.RotateTransform(_transAngle);
  5.             e.Graphics.TranslateTransform(total_transformX , total_transformY );
  6.             e.Graphics.ScaleTransform(_zoomSize, _zoomSize);
  7.             //e.Graphics.TranslateTransform(total_transformX * _zoomSize - Bound.X * _zoomSize / 2, total_transformY * _zoomSize + Bound.Y * _zoomSize / 2);
  8.             //
  9. //通过矩阵转化为笛卡尔坐标系。原点在左下方
  10.             e.Graphics.MultiplyTransform(new System.Drawing.Drawing2D.Matrix(1, 0, 0, -1, 0, this.ClientSize.Height/_zoomSize - toolStripProgressBar1.Height/_zoomSize));
  11.             try
  12.             {
  13.                 sList.Draw(e.Graphics);
  14.             }
  15.             catch { }
  16.             //scales
  17.             e.Graphics.DrawLine(Pens.Red, new PointF(0, this.ClientRectangle.Location.Y *_zoomSize), new PointF(0, 1000));
  18.             e.Graphics.DrawLine(Pens.Blue, new PointF(0, this.ClientRectangle.Location.Y *_zoomSize), new PointF(1000, this.ClientRectangle.Location.Y*_zoomSize));
  19.         }

你可能感兴趣的:(无论如何zoom,原点坐标不变)