在Visual Studio中更改Solution Explorer的背景颜色

时间:2008-10-09 20:20:37

标签: visual-studio

有没有办法在Visual Studio中使用主题更改解决方案资源管理器的背景颜色? - 或者其他任何方式?

我可以通过更改窗口范围的颜色设置来更改它,但显然会影响太多。

5 个答案:

答案 0 :(得分:35)

刚刚在一小时内创建了VS扩展,搜索扩展管理器为“SExColor”。享受;)

答案 1 :(得分:10)

@aloneguid ......很久以前就应该看过了..谢谢先生!

@ver(关于vs 2008解决方案的解决方案;) - 一种B52类型的方法,对devenv.exe内的任何SysTreeView32进行地毯式轰炸。可能是所需颜色的额外参数,否则RGB(220,220,220) - 最适合我

#include <windows.h>
#include "psapi.h"
#include "shlwapi.h"
#include "commctrl.h"


COLORREF clr = RGB(220,220,220);

BOOL CALLBACK wenum( HWND hwnd, LPARAM lParam)
{
   const UINT cb = 261;
   static wchar_t    name[] = L"SysTreeView32",
                     tmp[cb] = {0};
   if( ::GetClassNameW( hwnd, tmp, 260 ) && 0 == _wcsicmp( name, tmp ) )
   {
      ::SendMessageW( hwnd, TVM_SETBKCOLOR, 0, (LPARAM)clr );
   }

   return TRUE;
}

BOOL CALLBACK EnumTops(HWND hwnd, LPARAM lParam) 
{
    DWORD             dwThreadId  = 0, 
                     dwProcessId = 0;
    HINSTANCE         hInstance;
   static wchar_t derVS[]     = L"devenv.exe";
   wchar_t  name[_MAX_PATH]   = {0},
            *exe              = 0;

    HANDLE hProcess;
   if (!hwnd)  return TRUE;     // Not a window
   if (!::IsWindowVisible(hwnd)) return TRUE;       // Not visible

   if (!SendMessage(hwnd, WM_GETTEXT, sizeof(name), (LPARAM)name))
      return TRUE;      // No window title
   dwThreadId = GetWindowThreadProcessId(hwnd, &dwProcessId);
   hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
   if( !GetModuleFileNameEx(hProcess, 0, name, sizeof(name))) goto exit;

   exe = ::PathFindFileNameW( name );
   if( (void*)exe == (void*)name ) goto exit; // mhm? maybe not exit?

   if( _wcsicmp( derVS, exe ) ) goto exit;

   EnumChildWindows( hwnd, wenum, (LPARAM)hProcess );

exit:
   CloseHandle(hProcess);
   int res = GetLastError();
   return res;
}

int wmain(int argc, wchar_t * argv[]) 
{
   if( argc >= 2 )
   {
      wchar_t *end = 0;
      long l = wcstol( argv[1], &end, 16 );
      clr = (DWORD)l;
   }
   ::EnumWindows(EnumTops, NULL);
   return 0;
}

答案 2 :(得分:4)

不能通过Visual Studio本身的任何配置。

然而,您可能会“破解”Win32 API中的窗口对象(查找“窗口枚举”)。拥有窗口句柄后,您可以设置所需的所有特征。

此致

/罗伯特

答案 3 :(得分:4)

即使更改标准Windows背景颜色也不适用于解决方案资源管理器。这个Visual Studio bug report提到了这个问题。微软已将此标记为“已关闭 - 无法修复”。

哪个非常烦人!使用黑色主题并在屏幕一侧悬挂明亮的白色解决方案资源管理器非常烦人。

一种可能的解决方案是根本不使用解决方案资源管理器。 Productivity Power Tools提供称为“解决方案导航器”的解决方案资源管理器替代品。它目前也被硬编码为白色。但我认为有可能让该工具的开发人员增加对修改颜色的支持,而不是让Microsoft在Visual Studio中执行此操作。 (即使微软创建了PPT。)

答案 4 :(得分:3)

你可以使用其他的extenssion,你有很大的可能性让你的Visual Studio更好看;)(但我不确定你是否可以改变解决方案资源管理器的背景)

http://visualstudiogallery.msdn.microsoft.com/20cd93a2-c435-4d00-a797-499f16402378