There's a bug in PropertyGrid:
The property PropertyGrid.LineColor
has a DefaultValue
attribute Set to SystemColors.InactiveBorder
.
But the internal field lineColor
is initialized with SystemColors.ControlDark
.
This is bad, because the Windows Forms designer detects that the property has the same value as the DefaultValue
attribute, and therefore it does not write the designer code for the PropertyGrid.LineColor
property in InitializeComponent
. So at runtime, the property is initialized to SystemColors.ControlDark
.
As a quick hack, you can set the property after InitializeComponent
:
InitializeComponent();
propertyGrid.LineColor = SystemColors.InactiveBorder;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…