none
How To make a Custom "Pop-Up" Control?

    Question

  • Hello,

    I would like to create a custom "pop-up" control, composed mainly from a TreeView.
    How can I create a that control, that can appears over the others controls?

    I mean, if by eg. we have a Combobox, it's composed from a "TextBox" and a "ListView". Well, I would like to create a custom "ListView".

    In general Lines, I have a Button, and if I click on it, it should appears a pop-up treeview (my custom control) bellow this button and over the other controls.

    How can I manage it?
    Wednesday, January 30, 2008 7:11 AM

Answers

  •  

    Hi, serhio,

     

    Based on my understanding, you want to know how to create controls which can be poped up over all the other controls, don't you?

     

    I think a simple solution is to use ToolStripDropDown class to wrap a custom control, and you can add all the controls which you want to show in the pop up menu in the custom control.

    Here is a more detailed tutorial.

    http://www.codeproject.com/KB/miscctrl/simplepopup.aspx

     

    Hope this helps,

    Regards

     

    Friday, February 01, 2008 6:50 AM

All replies

  • You can fake this behavior my making a form that only has a ListView element showing. At display time, position the form at the desired location so that it looks like it dropped down.

     

    Make a form and embed your ListView in this form. Get rid of the caption and make the form non-sizable. Create the class and pass in the means whereby the form can figure out where it needs to be displayed. Display the form as a modal dialog which will temporarily disable the main application UI, which is something you will want. On form load, capture the mouse. Monitor the mouse move events. If a move exceeds the form's client area then release the mouse and close the form. Somewhere in there you will want to figure out what information needs to be returned and how that can be done. I'm not familiar enough with your particular needs so I can't really make a concrete suggestion but you will need to take two conditions into account - the user selects something and this value must be returned and the user hasn't selected anything so don't return anything.

    Wednesday, January 30, 2008 10:50 PM
  • The closest control that you can use is a ToolStripButton which can be wire-up to a custom host container (pop-up portion).

    Wednesday, January 30, 2008 11:27 PM
  •  

    Hi, serhio,

     

    Based on my understanding, you want to know how to create controls which can be poped up over all the other controls, don't you?

     

    I think a simple solution is to use ToolStripDropDown class to wrap a custom control, and you can add all the controls which you want to show in the pop up menu in the custom control.

    Here is a more detailed tutorial.

    http://www.codeproject.com/KB/miscctrl/simplepopup.aspx

     

    Hope this helps,

    Regards

     

    Friday, February 01, 2008 6:50 AM