Ricardo,
You didn't ask about this, but I wanted to point something out ... as you no doubt discovered, there is no way to visually sub-class the basic Winform controls (like Buttons, TextBoxes, etc.) without putting the control on a UserControl, as you have done. However, you don't *have* to do it this way if you create your sub-classes in code, rather than visually. With controls like Buttons, TextBoxes, ComboBoxes, etc, this is very easy to do.
You may have seen some of the threads here recently advocating (or not) putting multiple classes into one .cs file. Here is an example of what I mean:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace MyCompany.WinUI.MyClasses
{
public class MyComboBox : System.Windows.Forms.ComboBox
{
}
public class MyTextBox : System.Windows.Forms.TextBox
{
}
public class MyButton : System.Windows.Forms.Button
{
}
}
If you're in the "one file should contain only one class" camp, then you can break the above up into separate .cs files.
Basically creating the classes in code gets rid of the need to put the Button on a UserControl. The only downside is that you don't see anything visually, but honestly, with something like a sub-class for a TextBox or Button or any of these simple controls, I see no need for visually designing them.
Then, you can add them to your ToolBox, as Kevin outlined in his reply.
I hope this gives you some food for thought.
~~Bonnie
>I have created a new visual element type "user control" in C#. For example, a personalized command button.
>This has generated a file with extension .CS.
>Fine! now I need to insert this control called "myButton" in any winform that I create, how can I do this?
>
>My idea is be able to create visual personalized controls ( buttons, lists, checkboxes, etc ) in a class library like in VFP.
>But I want to start for the beginning and to create a simple personalized visual control and to use it in my winforms