开发者

Visual Inheritance

开发者 https://www.devze.com 2023-01-10 22:47 出处:网络
I have same settings for 开发者_运维百科all of my forms for example color , font , align, etc How can i do these settings for one form and inheriting it on all forms.

I have same settings for 开发者_运维百科all of my forms for example color , font , align, etc How can i do these settings for one form and inheriting it on all forms. thanks. Edition 1 : i am using Windows Forms.


One way would be to extend/inherit from the form class, set the properties the way you like in your constructor, and let your forms inherit from that class.

Something like:

class RedForm : Form
{
    public RedForm() { BackColor = Color.Red; }
}

and then make your forms based on RedForm rather than Form.

0

精彩评论

暂无评论...
验证码 换一张
取 消