Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Suppress components to be shown in toolbox
 

Suppress components to be shown in toolbox

Hi. I have some Component descendants in my class library. I don't want them to appear in the toolbox and choose item dialog if user manages to add them manually. ToolboxItem(false) attribute does not help in this situation. Are there any ways to accomplish this (attributes, custom ToolboxItem descendants)?

Thanks.
Alexey B  Wednesday, October 07, 2009 2:39 PM
Apply this attribute:

[DesignTimeVisible(false)]


Hans Passant.
  • Marked As Answer byAlexey B Wednesday, October 07, 2009 6:58 PM
  •  
nobugz  Wednesday, October 07, 2009 2:57 PM
Apply this attribute:

[DesignTimeVisible(false)]


Hans Passant.
  • Marked As Answer byAlexey B Wednesday, October 07, 2009 6:58 PM
  •  
nobugz  Wednesday, October 07, 2009 2:57 PM
Thanks for this solution. The only drawback is that toolbox item is still created, and only after component is dropped on the designer surface nothing happens (that's quite good for me). It would be nice if there is any way not to create the toolbox item for specified component at all.
Alexey B  Wednesday, October 07, 2009 7:03 PM
Hmm, I don't repro that.  I don't see a toolbox item at all with that attribute in place.  Did you intentionally add it to the toolbox?

Hans Passant.
nobugz  Wednesday, October 07, 2009 7:52 PM
The case is when class library is distributed as an assembly, not as source files in the solution. And yes, the original question is about suppressing components to be shown in toolbox when user intentionally tries to add components from my assembly to toolbox.
Alexey B  Wednesday, October 07, 2009 8:09 PM

You can use google to search for other answers

Custom Search

More Threads

• Custom control using unmanaged dll
• GroupBox in a UserControl, redux
• Windows form control
• Change the style of a windows form
• Control serialization sequence?
• crash when loading form designer
• Create a designable base control? / Code generation for subclassed controls
• Changing culture problem
• How to Publish latest build of application?
• Disable Control Designer for WinForm Control