[RESOLVED] How to create a nonvisual user control?
Hello all,
I trying to create a hidden user control. So that it is displayed in the component tray (lower area of design window, not on form) and not shown in the final application. Just like the ImageList-control, for example.
I don't seem to be able to find any information on doing this.
Re: How to create a nonvisual user control?
There's no such thing as a non-visual control. A control is by definition a UI element. The component tray is called that because it contains components, so you need to inherit the Component class.
http://search.msdn.microsoft.com/sea...nent+authoring
Re: [RESOLVED] How to create a nonvisual user control?
So, that why I couldn't find anything about nonvisual or hidden controls...
I'm still used to VB6's controls that could just be hidden.
Thank you.
Re: [RESOLVED] How to create a nonvisual user control?
So then what would you do John if you wanted to make a control that was non-visual?
Re: [RESOLVED] How to create a nonvisual user control?
Quote:
Originally Posted by RobDog888
So then what would you do John if you wanted to make a control that was non-visual?
Like I said, there is no such thing as a non-visual control in the .NET environment. A control is something that inherits the Control class. If you want to create something that you can add to a form in the design window that doesn't have a visual aspect then you would inherit the Component class. Note that Control itself inherits Component. The Control class adds the UI aspect to the functionality of the Component class.
Re: [RESOLVED] How to create a nonvisual user control?
Well I mean more of how the Open/SaveDialog control, for ex., would be.
Re: [RESOLVED] How to create a nonvisual user control?
The OpenFileDialog and SaveFileDialog classes both inherit the FileDialog class, which inherits CommonDialog, which inherits Component. Just like the MessageBox class, OpenFileDialog and SaveFileDialog are just classes that wrap the creation and display of a Form object. I'm not sure whether the Form object is created when you create the OpenFileDialog or when you call ShowDialogue, but either way it just uses the properties that you set to create a Form to spec and then displays it. It's the functionality of the Component class that allows you to add an instance of those dialogues to a form at design time.
Re: [RESOLVED] How to create a nonvisual user control?
Oh, ok. Thanks John. Just needed to know for future use. :)