コード例 #1
0
        //MOUSE MOVE event
        protected override bool OnMotionNotifyEvent(EventMotion evnt)
        {
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, MouseButton.None);

            if (MouseMove != null)
            {
                MouseMove(this, args);
            }
            return(base.OnMotionNotifyEvent(evnt));
        }
コード例 #2
0
        //MOUSE WHEEL
        protected override bool OnScrollEvent(EventScroll evnt)
        {
            //daca este inainte este pozitiva, daca este inapoi este negativa valoarea delta
            int delta = 120;

            if (evnt.Direction == ScrollDirection.Down)
            {
                delta = 0 - delta;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, delta, (int)evnt.X, (int)evnt.Y, MouseButton.None);

            if (MouseWheel != null)
            {
                MouseWheel(this, args);
            }
            return(base.OnScrollEvent(evnt));
        }
コード例 #3
0
        //MOUSE DOWN event
        protected override bool OnButtonPressEvent(EventButton evnt)
        {
            MouseButton btn = MouseButton.None;

            if (evnt.Button == 1)
            {
                btn = MouseButton.Left;
            }
            if (evnt.Button == 2)
            {
                btn = MouseButton.Middle;
            }
            if (evnt.Button == 3)
            {
                btn = MouseButton.Right;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, btn);

            if (MouseDown != null)
            {
                MouseDown(this, args);
            }

            //fa si clickurile si dublu-clickurile

            if (MouseDoubleClick != null && evnt.Type == EventType.TwoButtonPress)
            {
                args = new GcMouseEventArgs(this, 2, 0, (int)evnt.X, (int)evnt.Y, btn);
                MouseDoubleClick(this, args);
            }
            else if (MouseClick != null && evnt.Type == EventType.ButtonPress)
            {
                args = new GcMouseEventArgs(this, 1, 0, (int)evnt.X, (int)evnt.Y, btn);
                MouseClick(this, args);
            }

            return(base.OnButtonPressEvent(evnt));
        }
コード例 #4
0
        //MOUSE UP event + MOUSE CLICK + MOUSE DBL CLICK
        protected override bool OnButtonReleaseEvent(EventButton evnt)
        {
            MouseButton btn = MouseButton.None;

            if (evnt.Button == 1)
            {
                btn = MouseButton.Left;
            }
            if (evnt.Button == 2)
            {
                btn = MouseButton.Middle;
            }
            if (evnt.Button == 3)
            {
                btn = MouseButton.Right;
            }
            GcMouseEventArgs args = new GcMouseEventArgs(this, 0, 0, (int)evnt.X, (int)evnt.Y, btn);

            if (MouseUp != null)
            {
                MouseUp(this, args);
            }
            return(base.OnButtonReleaseEvent(evnt));
        }
コード例 #5
0
 protected virtual void OnGtkcontrol1MouseWheel(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse wheel!" + a.Delta);
 }
コード例 #6
0
 protected virtual void OnGtkcontrol1MouseDoubleClick(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse dbl click!" + a.Button);
     gtkcontrol1.BackColor = GraphUtil.gdkColorFromWinForms(System.Drawing.Color.AliceBlue);
 }
コード例 #7
0
 protected virtual void OnGtkcontrol1MouseClick(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     HollyLibrary.GcMouseEventArgs a = args;
     Console.WriteLine("mouse click!" + a.Button);
 }
コード例 #8
0
 protected virtual void OnGtkcontrol1MouseMove(object sender, HollyLibrary.GcMouseEventArgs args)
 {
     Console.WriteLine("mouse move!");
 }
コード例 #9
0
 //MOUSE WHEEL
 protected override bool OnScrollEvent(EventScroll evnt)
 {
     //daca este inainte este pozitiva, daca este inapoi este negativa valoarea delta
     int delta = 120;
     if( evnt.Direction == ScrollDirection.Down ) delta = 0 - delta;
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, delta, (int)evnt.X, (int)evnt.Y, MouseButton.None );
     if( MouseWheel != null ) MouseWheel( this, args );
     return base.OnScrollEvent (evnt);
 }
コード例 #10
0
 //MOUSE MOVE event
 protected override bool OnMotionNotifyEvent(EventMotion evnt)
 {
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, MouseButton.None );
     if( MouseMove != null ) MouseMove( this, args );
     return base.OnMotionNotifyEvent (evnt);
 }
コード例 #11
0
 //MOUSE UP event + MOUSE CLICK + MOUSE DBL CLICK
 protected override bool OnButtonReleaseEvent(EventButton evnt)
 {
     MouseButton btn  = MouseButton.None;
     if( evnt.Button == 1 ) btn = MouseButton.Left;
     if( evnt.Button == 2 ) btn = MouseButton.Middle;
     if( evnt.Button == 3 ) btn = MouseButton.Right;
     GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, btn );
     if( MouseUp != null ) MouseUp( this, args );
     return base.OnButtonReleaseEvent (evnt);
 }
コード例 #12
0
        //MOUSE DOWN event
        protected override bool OnButtonPressEvent(EventButton evnt)
        {
            MouseButton btn  = MouseButton.None;
            if( evnt.Button == 1 ) btn = MouseButton.Left;
            if( evnt.Button == 2 ) btn = MouseButton.Middle;
            if( evnt.Button == 3 ) btn = MouseButton.Right;
            GcMouseEventArgs args = new GcMouseEventArgs( this, 0, 0, (int)evnt.X, (int)evnt.Y, btn );
            if( MouseDown != null ) MouseDown( this, args );

            //fa si clickurile si dublu-clickurile

            if( MouseDoubleClick != null && evnt.Type == EventType.TwoButtonPress )
            {
                args = new GcMouseEventArgs( this, 2, 0, (int)evnt.X, (int)evnt.Y, btn );
                MouseDoubleClick( this, args );
            }
            else if( MouseClick != null && evnt.Type == EventType.ButtonPress)
            {
                args = new GcMouseEventArgs( this, 1, 0, (int)evnt.X, (int)evnt.Y, btn );
                MouseClick( this, args );
            }

            return base.OnButtonPressEvent (evnt);
        }