The foreground color in the VS2010 editor is not set in one place, and in many - in the Parameter Form. If you have Resharper installed, it also sets some foreground properties. The reason VS2010 is to allow individual elements (words) in the foreground to express different colors depending on their type (for example, comments, value types, enumerations, etc.), even if they are selected. In other words, VS2010 applies priority to the foreground color for these specific types in the general format of the selected text.
For example, when you look at the Fonts and Colors dialog, you will see an entry for user types. On my VS2010, its RGB value is RGB (43, 145, 175), which looks like a teal. If I change this color to red, the custom types in my foreground of the editor change to red and remain red even in the selection area.
In some cases, VS2010 overrides the foreground color, for example by applying a breakpoint to the line. On my VS2010 supported checkpoints, when in edit mode there is a white foreground color, regardless of the conditions in the line.
To answer the question of how to change the foreground color for all selected text, VS2010 does not support this out of the box.
I wrote the VS2010 extension as described here . I used the example code as is and added the lines:
selectedText[EditorFormatDefinition.ForegroundBrushId] = Brushes.Green; formatMap.SetProperties("Selected Text", selectedText);
... but that did not change the foreground color of the selected text to green. He stayed black. This is probably due to the WPF VS2010 editor using a Priority order for each format and one or more other formats that override the selected foreground text color.
asavage
source share