Windows 7中的DataGridView背景颜色 [英] DataGridView Background color in windows 7
问题描述
我已经在.NET 3.5,VS 2008,WinXP中开发了Windows窗体应用程序.我在表格中使用了DataGridView控件.当我在Windows XP中运行该应用程序时,网格将正确显示,但是如果我在Windows 7中运行该应用程序,则网格将显示为黑色.
对于textBox边框颜色,它也以有趣的方式起作用.
我的文本框和datagridview属性如下:
1. textboxTop.BackColor = LightSteelBlue;
2. DataGridViewData.BackgroundColor = InactiveCaptionText;
Windows XP:美观,流畅且根据属性设置
Wndows 7:文本框边框已更改,groupBox边框已更改,Datagridview BackgroundColor更改为黑色
预览链接样本:
WinXP:http://yfrog.com/muwinxpj
Win7:http://yfrog.com/16win7qj
那我该如何解决呢?
谢谢
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
推荐答案
这不是操作系统的问题,只是您选择的颜色. InactiveCaptionText ...黑色是不足为奇的. :-D
实际上,您应该将背景色设置为SystemColors.Window
或Color.White
.没关系.
文本框的边框颜色取决于视觉样式:System.Windows.Forms.VisualStyles.VisualStyleInformation.TextControlBorder
.该属性为只读.
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 toSystemColors.Window
orColor.White
. No big deal.
And the textbox border color depends on visual style:System.Windows.Forms.VisualStyles.VisualStyleInformation.TextControlBorder
. The property is readonly.
这篇关于Windows 7中的DataGridView背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!