|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Supress Alternating Row Style for Specific Data Grid Column?My DataGridView is set up like this:
* Main row background color = white * Alternating row background color = light gray I also have a read-only (non-editable) column I want to show up as solid dark gray (i.e., no alternating row colors), but it shows up as alternating dark/light gray. Is there any way to get around this? Thanks, -Dan Never mind...turned out I needed to use CellTemplate.Style.BackColor
instead of DefaultCellStyle.BackColor. -Dan Daniel Manes wrote: Show quoteHide quote > My DataGridView is set up like this: > * Main row background color = white > * Alternating row background color = light gray > > I also have a read-only (non-editable) column I want to show up as > solid dark gray (i.e., no alternating row colors), but it shows up as > alternating dark/light gray. > > Is there any way to get around this? > > Thanks, > > -Dan Oh nice
Show quoteHide quote "Daniel Manes" <danth***@cox.net> wrote in message news:1166655521.930603.324570@i12g2000cwa.googlegroups.com... > Never mind...turned out I needed to use CellTemplate.Style.BackColor > instead of DefaultCellStyle.BackColor. > > -Dan > > Daniel Manes wrote: >> My DataGridView is set up like this: >> * Main row background color = white >> * Alternating row background color = light gray >> >> I also have a read-only (non-editable) column I want to show up as >> solid dark gray (i.e., no alternating row colors), but it shows up as >> alternating dark/light gray. >> >> Is there any way to get around this? >> >> Thanks, >> >> -Dan > You can subscribe to the DataGridView's RowsAdded event. Each time a row is
added, you can set the style of the desired column. This would be a fast fix to that. Show quoteHide quote "Daniel Manes" <danth***@cox.net> wrote in message news:1166651374.747249.174570@79g2000cws.googlegroups.com... > My DataGridView is set up like this: > * Main row background color = white > * Alternating row background color = light gray > > I also have a read-only (non-editable) column I want to show up as > solid dark gray (i.e., no alternating row colors), but it shows up as > alternating dark/light gray. > > Is there any way to get around this? > > Thanks, > > -Dan > |
|||||||||||||||||||||||