ToolStripControlHost and a Custom Control RRS feed

  • Question

  • Hello

    I have a control that i have created extended the UserControl class. Within my control I have a DataGridView and a few methods helping organise and return results from it.

    I wanted my control to appear in a pane created by a ToolStripDropDown button. I have already perfromed such an activity using a CheckedListBox instead of my control with the aid of the ToolStripControlHost. I tried the same code with my control (instrumentOptionsPicker):

    this.toolStripDropDownButton1.DropDownItems.Add(new ToolStripControlHost(instrumentOptionsPicker1));

    Upon clicking on the dropdown button the pane just presents blank space. This space appears to be the same width as my control, but it does not have any height.

    If anyone has any ideas as to why this is happening and what i am doing wrong please don't hesitate to reply. Also if you want any more detail about what it is I am trying to do please request.

    Many Thanks




    Thursday, February 23, 2006 6:26 PM

All replies

  • To bump the thread :).

    To see if the control was being drawn in the dropdown control area I enabled the border on the instrumentOptionsPicker. This showed a box, approxmiately 2x2 pixels. To it seems like the control is being drawn, but it has no size (or a very small size). I have tried manipulating many of the size properties available within the ToolStripDropDownButton, DropDown, ToolStripControlHost and instrumentOptionsPicker classes with no avail.

    Does any of this new information help anyone with a resolution to this problem?

    Many Thanks


    Tuesday, February 28, 2006 12:44 AM
  • I ran into this issue recently in a VB project I was working on.  I was able to resolve the issue by changing the MinimumSize property on the UserControl from (0, 0) to be the same as the UserControl's Size property.

    Tuesday, April 4, 2006 8:34 PM
  • I came to the same conclusion, using the minimum size property of the control does it. Is there some inner control container thing that actually determines the size of the menu item? Why won't the control's size simply work? Or does it purposely use the minimum height because it expects fixed height elements? (like combo box, text box, etc)
    Thursday, June 5, 2008 9:02 PM