c# - How to paint inactive rows in DataGridViewComboBox column? -
i can easily paint items in datagridviewcombobox dropdown list. can't figure out how paint inactive cells in same column.
i've seen, studied , tried numberous examples classical combobox, don't understand aspects of datagridviewcombobox.
currently have datagridviewcustompaintcombobox class derived datagridviewcombobox. minimum set of overrides supply? can point me in right direction?
the required minimum paint inactive cells without focus seems celltemplate
assignment , paint()
override:
public class datagridviewcustompaintcombobox : datagridviewcomboboxcolumn { public datagridviewcustompaintcombobox() { base.new(); celltemplate = new datagridviewcustompaintcomboboxcell(); } } public class datagridviewcustompaintcomboboxcell : datagridviewcomboboxcell { protected override void paint(graphics graphics, rectangle clipbounds, rectangle cellbounds, int rowindex, datagridviewelementstates elementstate, object value, object formattedvalue, string errortext, datagridviewcellstyle cellstyle, datagridviewadvancedborderstyle advancedborderstyle, datagridviewpaintparts paintparts) { // modify received arguments here base.paint(...); // paint default parts (see paintparts argument) // add custom painting here } }
Comments
Post a Comment