One small question. I know the toolbox in Visual Studio has all the necessary components, but I was wondering if we could introduce our own “custom-made” tools. For example, the listbox tool. I’ve created a “SpeechListBox” class in which I’ve mentioned all the methods that I want my listbox to use, but when I’m in the “SpeechListBoxApplication” class (where I wanna use this listbox), the listbox with my methods doesn’t show up, instead the general listbox tool that doesn’t have my methods shows up.
What I want is to write something like private speechListBox1 SpeechListBox; and somehow introduce a visual form to the design class without confusing it with the toolbox’s listbox. Making the program realize that I want this type of list box with all the extended methods, not the general toolbox type.
Is there any way to either make our own listbox or add methods to the original listbox tool?
Well, if you derive your
SpeechListBoxfrom a class that either is or derives fromSystem.Windows.Forms.Control, when you compile your project it will show up in the Visual Studio control toolbox.If you aren’t sure which class to derive from, you’ll have to make some decisions. If you want to hand-draw everything yourself, derive straight from
Controlitself. If you want to build a control is is a composite of other controls, consider deriving fromUserControl. You don’t explicitly list exactly what you’re trying to do with your SpeechListBox, but you may want to consider just using aListBoxbut supplying it with custom drawn list items. You could do this by making your class derive fromListBoxor just configuring aListBoxto do what you want right in the form on which the listbox resides.