开发者

Any way to set per-solution color options (VS2010)?

Is there any way to configure VS2010 to use different color schemes for different solutions? On the Macintosh, in the 1990's, I could add wctb resources to documents so they would open with different color schemes. This made it easier to find 开发者_如何学JAVAthe right window to click, and also helped avoid accidentally typing something into the wrong document (otherwise easy to do if one has several similar documents open). Is there any nice way to achieve a similar effect in VS2010? I'd mainly like to change the text background color and window background color.

When I was using vs2005 and vbEx2005, I could set vbEx to one scheme and vs to another, but right now I'm using vs2010 for everything. Is there any nice way to set colors on a per-project basis?


Here's a nice way of doing it. Select "Macro IDE...", then open up "EnvironmentEvents" and add the following after the "Automatically generated code" region:

    Sub handleColorSettings() Handles SolutionEvents.opened, DocumentEvents.documentopening
        Dim myColor As UInt32
        myColor = &HC0FFFF
        Try
            myColor = UInt32.Parse(IO.File.ReadAllText(DTE.Solution.FullName & ".bgcolor.txt"), Globalization.NumberStyles.AllowHexSpecifier)
        Catch ex As Exception

        End Try
        CType(DTE.Properties("FontsAndColors", "TextEditor").Item("FontsAndColorsItems").Object, EnvDTE.FontsAndColorsItems).Item("Plain Text").Background = myColor
    End Sub

Any time a project is opened, or a file is opened within a project, the system will look for a file with the name "(fullSolutionName).bgcolor.txt". If, e.g., the solution is "myThing.sln", the file used will be "myThing.sln.bgcolor.txt". If such a file is found and it contains a valid hex number, that will be used as the background color. Otherwise, a default color (&hC0FFFF above, but easily changeable) will be used.


Not without writing some code. As Jared has already mentioned, the colors you want to change are part of the VS-level settings. However, it would be possible to author a VS extension (or even just a macro) that would toggle the settings to solution-specific preferences when a solution is opened.


You can run your Visual Studio as a different user and choose different color scheme per each user. First, you need to create a local user with administrator privileges. Then, Right click + Shift on Visual Studio -> Run as different user and enter the user you created and password. If you want to run your Visual Studio as a different user via Batch file, You can use the "runas" command or download "psexec" tool.


No. Colors are maintained on a per Visual Studio instance basis. There is no way to customize them any a finer granularity such as the project level.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜