Question

Is there a way in C# to create a design template for a component (a button for example) All the buttons in the project will inherit the design from the template. And whenever I change the template all the buttons will inherit the change. I want that my application will have the same look all the buttons will look the same, all the text box..... Thanks

Était-ce utile?

La solution

what you want to do can be achieved by creating your own inherited class of a control. e.g.

public class yourbuttontemplate : System.Windows.Forms.Button
{
    yourbuttontemplate() //constructor
    {
        this.Height=20;
        this.Width=40;
        this.BackColor=Color.Blue;
    }
}

Once you build your project, your button should be available in the toolbox and you can use this button instead of the default Windows.Forms.Button.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top