Mouse Capture problem?


Ö

Özden Irmak

Hello,

I'm creating a custom ComboBox control and the I have a problem while
showing the dropdown portion...

I basically want to prevent the form to loose focus also trying to route all
mouse events to that dropdown...The focus part works very well but I
couldn't set the capture to the dropdown. Here's how everything works :

protected override CreateParams CreateParams

{

get

{

CreateParams cp = base.CreateParams;

cp.ExStyle |= (WS_EX_NOACTIVATE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST);

return cp;

}

}



This is applied to dropdown control to prevent being shown in taskbar as a
window...

And I show that dropdown like this :



MyListBox.Capture = true;

SetParent(MyListBox.Handle,IntPtr.Zero);

ShowWindow(MyListBox.Handle,4);



I even tried "SetCapture" API instead of "Capture = true" but it's the same.
Does anybody know why this not works or show me a working code snippet?

Thanks in advance...

Özden Irmak
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top