문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top