Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Back ground color
Message
From
16/05/2003 16:12:38
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
General information
Forum:
ASP.NET
Category:
WebForms
Miscellaneous
Thread ID:
00786443
Message ID:
00789463
Views:
30
Thanks!

Jerry


>Hi Jerry,
>
>DataGrid background color property is ignored by DataGrid control. By default it is set to System.Color.Gray. It is still possible to change it using System.Reflection namespace components
>
>
>using System.Reflection;
>
>public static void SetGridBackColor(DataGrid dg, Color color)
>{
>   object oRenderer = typeof(DataGrid).GetField("m_renderer", BindingFlags.NonPublic|BindingFlags.Instance).GetValue(dg);
>   oRenderer.GetType().GetField("m_brushEmptyBack", BindingFlags.NonPublic|BindingFlags.Instance).SetValue(oRenderer, new SolidBrush(color) );
>}
>
>
>
>>Using a grid in a C# Winform, I defined a few columns and bound data to the grid.
>>
>>The data displays fine, but the grid height is set to display 10 rows at a time. However, sometimes there is less than 10 rows in the dataset. In this case, the rows with data display fine, that is the grid's background colors display fine, but the rest of the grid's background color is a dark grey.
>>
>>How can I ensure that my whole grid is always displayed in my defined colors, not just the portion of the grid that has rows?
>>
>>Thanks,
>>
>>Jerry
Previous
Reply
Map
View

Click here to load this message in the networking platform