none
Inkcanvas 如何重写onMouseMove方法? RRS feed

答案

  • 你要设计一个新类继承自 InkCanvas 才可以在里面重写 InkCanvas.OnMouseMove 方法。或者你就在InkCanvas.MouseMove事件上挂上一个事件处理函数。

      public class MyCanvas : InkCanvas
      {
        protected override void OnMouseMove(MouseEventArgs e)
        {
          // TO DO...
          base.OnMouseMove(e);
        }
      }
    

          InkCanvas inkcanvas = new InkCanvas();
          inkcanvas.MouseMove += new MouseEventHandler(inkcanvas_MouseMove);
    
       ......
    
        void inkcanvas_MouseMove(object sender, MouseEventArgs e)
        {
          // TO DO...
        }
    


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年9月8日 15:35
    版主

全部回复

  • 你要设计一个新类继承自 InkCanvas 才可以在里面重写 InkCanvas.OnMouseMove 方法。或者你就在InkCanvas.MouseMove事件上挂上一个事件处理函数。

      public class MyCanvas : InkCanvas
      {
        protected override void OnMouseMove(MouseEventArgs e)
        {
          // TO DO...
          base.OnMouseMove(e);
        }
      }
    

          InkCanvas inkcanvas = new InkCanvas();
          inkcanvas.MouseMove += new MouseEventHandler(inkcanvas_MouseMove);
    
       ......
    
        void inkcanvas_MouseMove(object sender, MouseEventArgs e)
        {
          // TO DO...
        }
    


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2011年9月8日 15:35
    版主
  • 你要设计一个新类继承自 InkCanvas 才可以在里面重写 InkCanvas.OnMouseMove 方法。或者你就在InkCanvas.MouseMove事件上挂上一个事件处理函数。

     

      public class MyCanvas : InkCanvas
      {
        protected override void OnMouseMove(MouseEventArgs e)
        {
          // TO DO...
          base.OnMouseMove(e);
        }
      }
    

     

     

          InkCanvas inkcanvas = new InkCanvas();
          inkcanvas.MouseMove += new MouseEventHandler(inkcanvas_MouseMove);
    
       ......
    
        void inkcanvas_MouseMove(object sender, MouseEventArgs e)
        {
          // TO DO...
        }
    

     


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    谢谢包包,受教了,多谢。
    2011年9月10日 6:19