Windows 10 Creators Update changes the style of PropertyGrid control

后端 未结 3 1480
一向
一向 2020-12-18 02:18

I just upgraded some systems to Windows 10 Creators Update and I noticed that the windows forms PropertyGrid control changed its default visual style for header

3条回答
  •  难免孤独
    2020-12-18 02:27

    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;
    

提交回复
热议问题