VisualStudio2010中的绿条

我想知道在 VisualStudio2010中这些绿色的东西是什么。这是干什么用的?它们看起来相当随机,但当然它们必须有某种意义。有人能告诉我吗?

乍一看,它们对我毫无意义。

图片1:

Image 1

图2:

Image 2

编辑:

它们在打开文档时显示已保存的更改内容。一旦关闭文档,它们就会消失。

40488 次浏览

This is edited lines of text after last save

or/and

Lines of code edited by Edit->Advanced->Format Document. It formats code (spaces, line breaks, etc) corresponding VS settings for current file's language

Those indicate where the source code has been changed.

They show lines that you have changed.

See here for more details and a table showing what the different colours mean:

+-----------+------------------------------+-------------------------+
| Marker    |     Different from           |    Different from file  |
|  colour   |       file saved on disk?    |      that was opened?   |
+-----------+------------------------------+-------------------------+
| Nothing   |        No                    |       No                |
| Yellow    |        Yes                   |       Yes               |
| Green     |        No                    |       Yes               |
| Orange    |        Yes                   |       No                |
+-----------+------------------------------+-------------------------+

Edit: Blue indicates that the line was changed, saved and then reverted by undoing.
To see the entire list of colour schemes, go to Tools>Opitons>Environment>Fonts and Colors.(or Ctrl+Q.then type "Fonts and Colors")

Yellow - source code that has been changed since you opened the file, and that hasn't been saved.

Green - source code that has been changed since you opened the file, and that has been saved.

IN SUMMARY...

Start out blank.

Make a change = Yellow.

Save the change = Green.

Undo = Orange.

Change the line again = Yellow.

Visual Studio editor margin can also show light blue bars. But it is only substitution of orange color in some dark themes.

In addition to other answers, please note that there is blue instead of orange in dark themes:

Light themes

enter image description here

Dark themes

(orange color is represented as light blue)

enter image description here

Customization

Using Visual Studio Color Theme Editor plugin from the Microsoft, you can focus on the following 3 items:

enter image description here

The same plugin is available also for more recent versions of Visual Studio, for example
Visual Studio 2015 Color Theme Editor.