• entries
    743
  • comments
    1924
  • views
    578653

Components

Sign in to follow this  
Aardvajk

61 views

I've just been discovering how to create custom controls in VS C# and have them available in the toolbox for all Windows Forms projects.

It is so easy, I'm in shock.

I remember trying to make Borland C++ Builder components a few years ago and tearing out my hair in frustration. It is so easy in C# that I just don't know what to say except, "Well done, Microsoft, you deserve all the money."

You just derive your class from either UserControl or an existing control. While this file is part of your project, every time you build, the componet appears in a section in the toolbox in the project and you can bung it on a form, edit the properties, everything.

When it's finished, I start a new Class Library project, copy paste the code for the component into the file and build.

I then move the resultant Release dll into my new References folder, run VS again and do the "Select toolbox items" or whatever from the Tools menu.

Browse to the DLL, click OK and all is done. It is that simple.

So my VirtualScrollBox component that I was asking about a few entries back is now fully functional in my toolbox.

Map.NET is getting started again now with all this in mind.

The only thing I haven't figured out is how to provide the image for the toolbox, but I don't actually want to know. The whole point of learning this is to increase my productivity and messing about for hours trying to get the icon for a component to look right is only going to waste time.

So please don't tell me if you know how to do it because I'm really happy as I am at the moment [smile].
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now