예제 #1
0
        //I override the default event " Onclick"
        //adding the detection of "triangle click"

        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnClick(e);
            // if the user use this delegate...
            if (this.TriangleClick != null)
            {
                //check if the user click on the left triangle
                //or in the right with some geometrics  rules...
                //(is't possible to click all triangle at the same time )

                int x = e.X;
                int y = e.Y;

                if ((x < _triangle) && (y <= (_triangle - x)) ||
                    (x > this.ClientRectangle.Width - _triangle) && (y >= (this.ClientRectangle.Height - _triangle - x)))
                {
                    //try with right...
                    TriangleClickEventArgs te = new TriangleClickEventArgs(false);
                    //if not...
                    if ((x < _triangle) && (y <= (_triangle - x)))
                    {
                        te = new TriangleClickEventArgs(true);
                    }

                    this.TriangleClick(this, te);
                }
            }
        }
예제 #2
0
 void SpringButton8TriangleClick(object sender, Spring_Button.TriangleClickEventArgs e)
 {
     if (e.Isleft == true)
     {
         MessageBox.Show("A Click on the LEFT triangle!!");
     }
     else
     {
         MessageBox.Show("A Click on the RIGHT triangle!!");
     }
 }