Building your own controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I would like to build my own controls from the ground up. Just as if the
Combobox didn't excist and I wanted to create this 'new control' with all is
glorious functionality. Is there a technology used for this purpose in .net.

Regards
Jesper.
 
Suggestion: Before you reinvent the wheel, study how the wheel was
originally built. Get yourself a copy of Lutz Roeder's "Reflector", load the
appropriate Framework assembly, and disassemble the ComboBox class.
Peter
 
Jesper,

You would want to derive from the Control class in this case.

I don't know if that is exactly what you want, I get the feeling that
you are looking for tools as well to help you build your control? If that
is the case, there isn't much in VS.NET to help you with this. Because you
are building your control from the ground up, you have to handle everything,
like painting, response to mouse input, keyboard input, etc, etc.

Hope this helps.
 
The ControlPaint class can help quite a bit with painting, at least. But
yes, it is entirely your responsibility to say what and when.

Of course, if you simply want a variation of an existing control, you might
be better off inheriting from it and adding the custom functionality you
want, instead of reinventing something from scratch. You can also derive
from UserControl.

--
Brian Schwartz
FishNet Components
http://www.fishnetcomponents.com
Fish Grid .NET Light: Powerful Layouts for Small Datasets


Nicholas Paldino said:
Jesper,

You would want to derive from the Control class in this case.

I don't know if that is exactly what you want, I get the feeling that
you are looking for tools as well to help you build your control? If that
is the case, there isn't much in VS.NET to help you with this. Because
you are building your control from the ground up, you have to handle
everything, like painting, response to mouse input, keyboard input, etc,
etc.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jesper said:
Hi,

I would like to build my own controls from the ground up. Just as if the
Combobox didn't excist and I wanted to create this 'new control' with all
is
glorious functionality. Is there a technology used for this purpose in
.net.

Regards
Jesper.
 
Hi,

I would like to build my own controls from the ground up. Just as if the
Combobox didn't excist and I wanted to create this 'new control' with all is
glorious functionality. Is there a technology used for this purpose in .net.

If you are doing this as a learning exercise, then I would follow
Peter's suggestion and get a copy of Reflector.

If you have a particular application in mind, then I would suggest
that this type of thing is going to be much easier in WPF / Avalon
than in the current Windows Forms as it appears in .NET. Get your
hands on a beta copy of Visual Studio Orcas and start reading up on
Windows Presentation Framework. It allows far more control over
customization of controls than does Windows Forms. (The only catch is
that it's beta... or 1.0, depending upon how you want to look at it.)
 
Back
Top