diff options
author | Nikita Voronchev <nikita.voronchev@ru.axxonsoft.com> | 2020-02-27 13:25:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 13:25:14 +0300 |
commit | 4b42804803dae2c0b5c5ff0c87e0e2d7301f434b (patch) | |
tree | fd41da35f4a1a7a767b566b0360d3be272f058d4 /mcs | |
parent | 5e5b1ed4250e57dc926c28a222bcf9d9eaf3e037 (diff) |
[WinForms] Colorize PropertyGrid's Categories properly (#19045)
Assume, one have colorized `PropertyGrid propertyGrid` control:
```
propertyGrid.CategoryForeColor = Color.Red;
propertyGrid.LineColor = Color.Blue;
```
Before changes proposed by the current PR we get the following image:
![before](https://user-images.githubusercontent.com/12382656/75364102-3391fe80-58cc-11ea-9136-347bcd567731.png)
After:
![after](https://user-images.githubusercontent.com/12382656/75364115-3987df80-58cc-11ea-95d1-20691a4a8467.png)
(item labeled "_Child 2_" is selected by user)
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs | 2 | ||||
-rw-r--r-- | mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGridView.cs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs index 5996403372b..d13e643f0d1 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGrid.cs @@ -99,7 +99,7 @@ namespace System.Windows.Forms property_tabs = new PropertyTabCollection(this); line_color = SystemColors.ScrollBar; - category_fore_color = line_color; + category_fore_color = SystemColors.ControlText; commands_visible = false; commands_visible_if_available = false; property_sort = PropertySort.CategorizedAlphabetical; diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGridView.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGridView.cs index abb59846d44..2d3a484bca0 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGridView.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/PropertyGridView.cs @@ -598,7 +598,7 @@ namespace System.Windows.Forms.PropertyGridInternal { if (grid_item.GridItemType == GridItemType.Category) { font = bold_font; - brush = SystemBrushes.ControlText; + brush = ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.CategoryForeColor); pevent.Graphics.DrawString (grid_item.Label, font, brush, rect.X + 1, rect.Y + ENTRY_SPACING); if (grid_item == this.SelectedGridItem) { @@ -667,11 +667,11 @@ namespace System.Windows.Forms.PropertyGridInternal { 0, yLoc, V_INDENT, row_height); if (grid_item.GridItemType == GridItemType.Category) { - pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.CategoryForeColor), depth*V_INDENT,yLoc,ClientRectangle.Width-(depth*V_INDENT), row_height); + pevent.Graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (property_grid.LineColor), depth*V_INDENT,yLoc,ClientRectangle.Width-(depth*V_INDENT), row_height); } DrawGridItemLabel (grid_item, pevent, - depth, + depth, new Rectangle (depth * V_INDENT, yLoc, SplitterLocation - depth * V_INDENT, row_height)); DrawGridItemValue (grid_item, pevent, depth, |