Created
October 28, 2009 06:56
-
-
Save NoahRic/220306 to your computer and use it in GitHub Desktop.
Code for setting the active selection to use a gradient brush, like beta 1 (VS 2010 Beta 2).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SetGradientBrush(IEditorFormatMap formatMap) | |
{ | |
Color highlight = SystemColors.HighlightColor; | |
Color darkColor = Color.FromArgb(96, highlight.R, highlight.G, highlight.B); | |
Color lightColor = Color.FromArgb(48, highlight.R, highlight.G, highlight.B); | |
// Change the selected text properties to use a gradient brush and an outline pen | |
var properties = formatMap.GetProperties("Selected Text"); | |
properties[EditorFormatDefinition.BackgroundBrushId] = new LinearGradientBrush( | |
new GradientStopCollection() { new GradientStop(darkColor, 0.0), new GradientStop(lightColor, 0.5), new GradientStop(darkColor, 1.0) }, 90.0); | |
properties["BackgroundPen"] = new Pen(SystemColors.HighlightBrush, 1) { LineJoin = PenLineJoin.Round }; | |
formatMap.SetProperties("Selected Text", properties); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment