先说问题,我在winForm的一片区域上点击鼠标找不到这个事件的归属,就是点击鼠标不知道哪个控件发生了mouseDown()事件,因为这片区域有点复杂,点击的是pictureBox,而pictureBoX属于自定义控件NetChart,pictureBox.Dock=Fill;而Netchart又是一个SplitPanel.Panel1;我试验了几个控件的mouseDown事件,都得不到反应,求解!!!

解决方案 »

  1.   

        public class NetChart : UserControl
        {
            private PictureBox _PictureBox;
            public NetChart()
            {
                _PictureBox = new PictureBox();
                _PictureBox.Dock = DockStyle.Fill;
                _PictureBox.MouseClick += MyMouserClick;            this.MouseClick += MyMouserClick;            this.Controls.Add(_PictureBox);
            }        private void MyMouserClick(object sender, EventArgs e)
            {
                MessageBox.Show(sender.GetType().Name);
            }
        }