Hi!!! I create my own custom control and everything is perfect except this event. I don't understand it. When i add my custom control to Window Form i add MouseDoubleClick event to this control. And when i start Application and try to double click on it is nothing happen. I'm not very sure but i think i need to create my own MouseDoubleClick event on my custom control and i try to do that but the result is same. How can i fix this problem !!! Thanks in advance! And i apology for my bad English!!!

I have found that the controls you add to your UserControl capture the mouse and do not pass the clicks on to the base control.

You need to capture each of the child control click and double click events and pass them on.

This code snippet shows how to do this for the DoubleClick event.

public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        protected override void OnControlAdded(ControlEventArgs e)
        {
            base.OnControlAdded(e);
            e.Control.DoubleClick += new EventHandler(Control_DoubleClick);
        }

        protected override void OnControlRemoved(ControlEventArgs e)
        {
            e.Control.DoubleClick -= new EventHandler(Control_DoubleClick);
            base.OnControlRemoved(e);
        }

        void Control_DoubleClick(object sender, EventArgs e)
        {
            this.OnDoubleClick(e);
        }

    }

Thank you for your answer. I'll try your suggestion and answer you later. :)

Thank you very much is Work perfect. :)

so what do you do with this class. I odn<t know how to integrate this in order to have the mouse doubleclick event .
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.