Ask a questionAsk a question
 

Answergradient of text selection is no good

  • Tuesday, June 02, 2009 9:40 AMcitykid2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    In VS2010 the selection in the text editor has a gradient and a border. I find this nice but distracting for work. I would like to ba able to turn off this gradient and maybe also the border.


    I would like to add a screenshot here but do not know how to do that.

Answers

  • Tuesday, June 02, 2009 6:04 PMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    If you go to Tools->Options->Environment, and
    1) Un-check "Automatically adjust visual experience based on client performance", and
    2) Make sure "Enable rich client experience" is unchecked

    The editor should switch to a simpler selection UI.

    -Noah
  • Thursday, June 04, 2009 12:41 AMBrittany BehrensMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I'll also add that the look and feel of selection will likely change for the final release of VS 2010 - as you mention, the gradient is a bit distracting, and it can slow down performance somewhat.  Noah's solution should mitigate this for Beta1, and you'll probably see something simpler and less obtrusive as the default in the next version.

    Thanks for trying VS 2010 Beta1 and posting your feedback!

    Brittany Behrens
    Program Manager, VS Platform
    http://blogs.msdn.com/vseditor

All Replies

  • Tuesday, June 02, 2009 6:04 PMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    If you go to Tools->Options->Environment, and
    1) Un-check "Automatically adjust visual experience based on client performance", and
    2) Make sure "Enable rich client experience" is unchecked

    The editor should switch to a simpler selection UI.

    -Noah
  • Thursday, June 04, 2009 12:41 AMBrittany BehrensMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I'll also add that the look and feel of selection will likely change for the final release of VS 2010 - as you mention, the gradient is a bit distracting, and it can slow down performance somewhat.  Noah's solution should mitigate this for Beta1, and you'll probably see something simpler and less obtrusive as the default in the next version.

    Thanks for trying VS 2010 Beta1 and posting your feedback!

    Brittany Behrens
    Program Manager, VS Platform
    http://blogs.msdn.com/vseditor
  • Thursday, June 04, 2009 12:00 PMcitykid2 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thank you very much, that helps!
    And compliments for the overall visual appearance of VS 2010, I like it a lot. It is just the selection gradient that I think goes too far.

    cheers
    ~thomas
  • Thursday, October 22, 2009 10:23 PMTheInitialCommand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have to disagree here.  I think that the gradient and alpha blended selection from BETA 1 was incredibly good looking and a welcome change.  It made it very clear what code blocks were selected and easy to trace it as you selected especially large blocks.

    I am very disappointed that the feature is missing from Visual Studio 2010 BETA 2.  I cant seem to find the options to turn it back on, is it completely missing from BETA 2?

    Thanks,
  • Friday, October 23, 2009 2:16 AMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That's certainly understandable.

    There are two answers to this:

    The first (and hopefully less important) answer is that the gradient selection is no longer an option you can select in tools->options.  The rich and non-rich(?) client experience are both a solid color selection.

    However, the second answer is that you (or anyone) can write an extension to add the gradient back.  The underlying code in the editor for drawing a gradient brush selection is still around, so you just need to override the editor's default selection brush.

    I'll work on putting an extension together that does this.  When I'm done, I'll write something up on my blog about it (blogs.msdn.com/noahric), so watch there for any updates.

    Thanks,
    -Noah
  • Friday, October 23, 2009 4:47 AMTheInitialCommand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Noah,

    Thats a great idea and I think you would make a lot of people happy if you made that extension happen.  Now that you threw the idea out there, I am also going to look into developing a custom extension, maybe we can share some ideas.  Would be great if Microsoft was actually able to post their code if they have really removed the feature and shelved it.  It sure seems that way since flagging the rich experience option no longer seems to make a difference.  Maybe it will resurface as an explicit option in the Release Candidate.
  • Friday, October 23, 2009 6:27 AMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I'll dig up the old gradient definitions to share - my attempt at recreating it has made some really, really ugly gradients :), so I'm going to stop before I make myself sick from looking at them.

    Thanks,
    -Noah
  • Friday, October 23, 2009 6:08 PMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    If you go here, you can see the code that does this:
    http://github.com/NoahRic/GradientSelection

    It matches the old behavior for picking a gradient; namely it uses the system highlight color at different opacities (you can see that in ViewCreationListener.cs).

    I haven't uploaded it to the vsgallery yet, but I should be able to get to that in the near future.

    Let me know if you get a chance to try it out.  To build it, you'll need to install the SDK.

    Thanks,
    -Noah
  • Wednesday, October 28, 2009 7:46 AMLexx_QQ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello Noah Richards.

    I downloaded, compiled and added extension to Visual Studio 2010 Beta 2, but the gradient selection is not the beginning of work, but the list of extensions it is. Also not work and ItalicComments. what could be the problem?

    Thank you.
  • Wednesday, October 28, 2009 11:17 AMLexx_QQ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I understand what was the problem. We had to put the checkbox (Environment -> Extension manager -> "Load per user extensions whenrunning as administrator"). After that, things started to work :)
  • Monday, November 02, 2009 10:14 PMTheInitialCommand Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi Noah,

    Your gradient plugin works awesome, it looks exactly like it did in Beta 1.  I got it to compile and install just fine.

    I noticed that inactive selection isnt implementd so I took the liberty to implement it.  Can you merge this code into yours, goes at the bottom of SetGradientBrush()

    // Changes by TheInitialCommand
    // Change theINACTIVE selected text properties to use a gradient brush and an outline pen
    Color inactiveHighlight = SystemColors.InactiveCaptionColor;
    Color inactiveDarkColor = Color.FromArgb(96, inactiveHighlight.R, inactiveHighlight.G, inactiveHighlight.B);
    Color inactiveLightColor = Color.FromArgb(48, inactiveHighlight.R, inactiveHighlight.G, inactiveHighlight.B);
    			
    var inactiveProperties = formatMap.GetProperties("Inactive Selected Text");
    			inactiveProperties[EditorFormatDefinition.BackgroundBrushId] = new LinearGradientBrush(
    new GradientStopCollection() { new GradientStop(inactiveDarkColor, 0.0), new GradientStop(inactiveLightColor, 0.5), new GradientStop(inactiveDarkColor, 1.0) },
    				90.0);
    //inactiveProperties["BackgroundPen"] = new Pen(SystemColors.HighlightBrush, 1) { LineJoin = PenLineJoin.Round };
    inactiveProperties["BackgroundPen"] = new Pen(SystemColors.InactiveCaptionBrush, 1) { LineJoin = PenLineJoin.Round };
    formatMap.SetProperties("Inactive Selected Text", inactiveProperties);
    


    I have also noticed an issue when the user changes their colors the gradients get reset.  Will need to introduce an event handler that calls SetGradientBrush when user 'fonts and colors' are updated.

    Thanks for the great work!
  • Tuesday, November 03, 2009 12:33 AMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hey, thanks for the feedback.

    The code on github is Ms-PL, so feel free to fork it/change it/release your own extension based off it.  The version I uploaded was meant to be more of a simple starting off point than a complete solution; as you pointed out, it is missing at least 3 things:

    1) Doesn't update correctly when the selection brush in the format map is changed by VS
    2) Doesn't change the inactive brush (this was partially because I'm not a big fan of the gradient gray)
    3) Uses SystemColors instead of using the VS specific settings in fonts and colors

    Let me know if you have any questions.

    -Noah
  • Tuesday, November 03, 2009 12:36 AMNoah RichardsMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Also, for anyone else interested - I uploaded a version of this to vsgallery, so you can grab it from the extension manager in VS (search for "gradient"), or you can download it here:

    http://visualstudiogallery.msdn.microsoft.com/en-us/7687f71d-49aa-4cbd-b0ad-6f90c9a64572

    Thanks,
    -Noah
  • Tuesday, November 03, 2009 3:01 PMLexx_QQ Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code
    Hi Noah,

    Your gradient plugin works awesome, it looks exactly like it did in Beta 1.  I got it to compile and install just fine.

    I noticed that inactive selection isnt implementd so I took the liberty to implement it.  Can you merge this code into yours, goes at the bottom of SetGradientBrush()

    // Changes by TheInitialCommand
    
    // Change theINACTIVE selected text properties to use a gradient brush and an outline pen
    Color inactiveHighlight = SystemColors.InactiveCaptionColor;
    Color inactiveDarkColor = Color.FromArgb(96, inactiveHighlight.R, inactiveHighlight.G, inactiveHighlight.B);
    Color inactiveLightColor = Color.FromArgb(48, inactiveHighlight.R, inactiveHighlight.G, inactiveHighlight.B);

    var inactiveProperties = formatMap.GetProperties("Inactive Selected Text" );
    inactiveProperties[EditorFormatDefinition.BackgroundBrushId] = new LinearGradientBrush(
    new GradientStopCollection() { new GradientStop(inactiveDarkColor, 0.0), new GradientStop(inactiveLightColor, 0.5), new GradientStop(inactiveDarkColor, 1.0) },
    90.0);
    //inactiveProperties["BackgroundPen"] = new Pen(SystemColors.HighlightBrush, 1) { LineJoin = PenLineJoin.Round };
    inactiveProperties["BackgroundPen" ] = new Pen(SystemColors.InactiveCaptionBrush, 1) { LineJoin = PenLineJoin.Round };
    formatMap.SetProperties("Inactive Selected Text" , inactiveProperties);


    I have also noticed an issue when the user changes their colors the gradients get reset.  Will need to introduce an event handler that calls SetGradientBrush when user 'fonts and colors' are updated.

    Thanks for the great work!
    10x  :) that is COOL