Click here to Skip to main content
15,903,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I've developed a Windows Forms application in .NET 3.5, VS 2008, WinXP. I've used a DataGridView control in the form. When i run the application in Windows XP the grid is displayed properly but the same application if i am running it in Windows 7, the grid is displayed in black color.

For textBox border color also it acts in funny manner.

My textbox and datagridview properties are as follows:

1. textboxTop.BackColor = LightSteelBlue;

2. DataGridViewData.BackgroundColor = InactiveCaptionText;



Windows XP: nice and smooth and according as the property set

Wndows 7 : textbox border changed, groupBox border changed, Datagridview BackgroundColor changed to black



Sample preview links:

WinXP : http://yfrog.com/muwinxpj

Win7 : http://yfrog.com/16win7qj


So how should I resolve this?
Thanks
Posted

1 solution

It is not the OS problem, it is just the color you've chosen. InactiveCaptionText... No surprise that it is black. :-D

In fact you should set background color to SystemColors.Window or Color.White. No big deal.

And the textbox border color depends on visual style: System.Windows.Forms.VisualStyles.VisualStyleInformation.TextControlBorder. The property is readonly.
 
Share this answer
 
v2
Comments
Shukra 3-Aug-10 22:10pm    
Wow finally got an answer, I thought I would never get reply on CP. My main concern was textbox and groupbox border color. Cause I already fixed the datagridview background color.
Anyways thank you Dima for taking time to answer my question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900