c# - Inherits from DataGridView with custom properties -
i've written own grid inherits datagridview class , has custom properties , columns.
like :
public class foo : datagridview { private system.windows.forms.datagridviewtextboxcolumn c1; public foo() { initializeclass(); } void initializeclass() { this.autogeneratecolumns = false; c1 = new datagridviewtextboxcolumn(); this.c1.datapropertyname = "c1"; this.c1.headertext = "column 1"; this.c1.name = "c1"; } }
the program runs well, visual studio creating mess code! in initializecomponent() vistual studio creates again datagridviewcolumns properties :s
is there way avoid behavior.
thnks!
update : autogeneratecolumns set false
you either create columns @ runtime, think checking system.componentmodel.licensemanager.usagemode
works, or hide columns
property designerserializationvisibility
attribute.
Comments
Post a Comment