Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Back ground color
Message
De
16/05/2003 16:12:38
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Divers
Thread ID:
00786443
Message ID:
00789463
Vues:
31
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform