Exemple #1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     if (MyMouseMove != null)
     {
         MyMouseEventArgs myMouseEventArgs = new MyMouseEventArgs();
         myMouseEventArgs.X = e.X;
         myMouseEventArgs.Y = e.Y;
         myMouseEventArgs.nLine = Point2Position(new Point(e.X, e.Y)).Line;
         myMouseEventArgs.nPos = Point2Position(new Point(e.X, e.Y)).Pos;
         MyMouseMove(this, myMouseEventArgs);
     }
     base.OnMouseMove(e);
 }
Exemple #2
0
 private void myTextbox1_MyMouseMove(object sender, MyMouseEventArgs e)
 {
     string s = string.Format("X={0}\nY={1}\nLine={2}\nPos={3}", e.X, e.Y, e.nLine, e.nPos);
     label1.Text = s;
     Invalidate();
 }
Exemple #3
0
        /// <summary>
        /// OnMouseDown
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            // 文字ごとにサイズが異なることを考慮しないといけない。
            // 結構めんどうそうだ・・・まずは表示させるところからやるか・・・
            //            CurrentPhysicalPosition = Point2Position(new Point(e.X, e.Y));
            CurrentLogicalPosition = Point2LogicalPosition(new Point(e.X, e.Y));

            if (MyMouseDown != null)
            {
                MyMouseEventArgs myMouseEventArgs = new MyMouseEventArgs();
                myMouseEventArgs.X = LogicalPosition2Point(CurrentLogicalPosition).X;
                myMouseEventArgs.Y = LogicalPosition2Point(CurrentLogicalPosition).Y;
                myMouseEventArgs.nLine = CurrentLogicalPosition.Line;
                myMouseEventArgs.nPos = CurrentLogicalPosition.Pos;
                MyMouseDown(this, myMouseEventArgs);
            }

            this.Focus();
            base.OnMouseDown(e);
        }