Frage

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

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top