Is it nice to inherit from standard widgets and set your own default values ​​in C #?

When developing an application in Visual Studio (C #), if I know that I will have a certain amount of DataGridViews, all have the same properties (such as width, height, color, some other properties, such as: disable the ability to directly edit rows, and etc.), is it good to make my own class ("myDataGridView"), which inherits the DataGridView class and performs all the settings there, and then just creates this class later in the code? Like this:

//my class:
class myDataGridView : DataGridView 
{
    this.BorderStyle = <someValue>
    this.ColumnCount = <someValue>
    //etc.

    public void method1() 
    {
    //some code...
    }
    public void method2() 
    {
    //some code...
    }
}

//instantiate it somewhere:
myDataGridView dgv1 = new myDataGridView();
myDataGridView dgv2 = new myDataGridView();
myDataGridView dgv3 = new myDataGridView();

Is this normal regarding OO principles? My friend says putting code as

this.BorderStyle = <someValue>

myDataGridView , dataGridView, Visual Studio, , . ? , DataGridView , , ? , DataGridView , , , , , myDataGridView. ? , , , DataGridView, /? .

+3
2

-, . . , .

+5

, , [Browsable (false)].

, . : " ". . __curious_geek , , , - . , , . , , .

+1

All Articles