コード例 #1
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            base.OnMouseMove(e);

            if (CheckBoxBounds.Contains(e.X, e.Y))
            {
                Debug.WriteLine("Owner.Cursor = Cursors.Hand e.X=" + e.X + " e.Y=" + e.Y + " CheckBoxBounds (" + CheckBoxBounds.ToString() + ")");
                Owner.Cursor = Cursors.Hand;

                if (!Selected)
                {
                    SetSelected(true);
                }
            }
            else
            {
                Debug.WriteLine("Owner.Cursor = Cursors.Default e.X=" + e.X + " e.Y=" + e.Y + " CheckBoxBounds (" + CheckBoxBounds.ToString() + ")");
                Owner.Cursor = Cursors.Default;

                if (Selected)
                {
                    SetSelected(false);
                }
            }
        }
コード例 #2
0
        public override void OnMouseDown(MouseEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            base.OnMouseDown(e);

            if (CheckBoxBounds.Contains(e.X, e.Y))
            {
                CancelEventArgs cev = new CancelEventArgs();
                OnCheckChanging(cev);
                if (!cev.Cancel)
                {
                    Checked = !Checked;
                    OnCheckChanged(e);
                }
            }
        }