Home All Groups Group Topic Archive Search About

Supress Alternating Row Style for Specific Data Grid Column?

Author
20 Dec 2006 9:49 PM
Daniel Manes
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

Author
20 Dec 2006 10:58 PM
Daniel Manes
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
Author
20 Dec 2006 11:10 PM
Thomas Holloway
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
>
Author
20 Dec 2006 11:05 PM
Thomas Holloway
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
>