예제 #1
0
 private void ProcessPan(MouseEventArgs args)
 {
     if (ClientRectangle.Contains(args.X, args.Y))
     {
         if (args.Button == System.Windows.Forms.MouseButtons.Left)
         {
             double dx = (double)(args.X - mouseDownPoint.X);
             double dy = (double)(args.Y - mouseDownPoint.Y);
             dx /= gViewer.LocalScale;
             dy /= gViewer.LocalScale; //map it to real coord
             int dh = gViewer.ScaleFromSrcXToScroll(dx);
             int dv = gViewer.ScaleFromSrcYToScroll(dy);
             gViewer.HVal = mouseDownHVal - dh;
             gViewer.VVal = mouseDownVVal + dv;
             gViewer.Invalidate();
         }
         else
         {
             GViewer.Hit(args);
         }
     }
 }