无论如何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.         }
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值