Popup listbox

bufer24

Newcomer
Joined
Jun 5, 2008
Messages
14
Hello, I wonder how do I make a usercontrol that pops up a listbox. Just like the search box in Google.
The problem is, that when I put a listbox in my usercontrol, it displays within the control bounds. This list though needs to be displayed outside the control bounds. How do I do this?
 

Attachments

Does the autocomplete feature of the text and combo box controls suit your needs? Set AutoCompleteMode to Suggest or SuggestAppend, AutoCompleteSource to CustomSource, and AutoCompleteCollection to your list of suggestions.

If you need something custom, writing your own auto complete control is hardly trivial. Since you're specifically asking about the popup, I can give you a tip or two. The popup needs to be implemented as its own form. You would need to look up how to properly set the styles (and maybe some other properties... I don't remember) of the form so that it doesn't take focus. You want the textbox and its containing form to keep focus.
 
Yes, I want the listbox to be OwnerDrawn to display parts of text as bold or to put some links or icons into the listbox items.

I tried to use a form with some success, but I stumbled across this issue: I want to close the popup as soon as the textbox loses focus to a control other than the popup. And I don´t now how to achieve this, because I can catch only the textbox.LostFocus event, but at that moment I need to know wether the focus went to the popup or somewhere else.
 
Back
Top