代码之家  ›  专栏  ›  技术社区  ›  zadam

在Visual Studio中更改解决方案资源管理器的背景色

  •  57
  • zadam  · 技术社区  · 16 年前

    是否有任何方法可以使用主题更改Visual Studio中解决方案资源管理器的背景色?-或者其他的方法?

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

    5 回复  |  直到 12 年前
        1
  •  35
  •   Ivan G.    13 年前

    只需在一小时内创建vs扩展名,在扩展名管理器中搜索“sexcolor”。享受;

        2
  •  10
  •   user1195662    13 年前

    @阿隆古德……应该很久以前见过……谢谢您,先生!

    @Ver(关于Vs2008解决方案;)—一种B52类型的方法,地毯式轰炸devenv.exe中的任何系统视图32。可能需要额外的颜色参数,否则RGB(220220220)-最适合我

    #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;
    }
    
        3
  •  4
  •   CleverPatrick    14 年前

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

    这很刺激!使用一个黑暗的主题,并有一个亮白色的解决方案探索者挂在屏幕的一侧,是非常恼人的。

    一种可能的解决方案是根本不使用解决方案资源管理器。这个 Productivity Power Tools 提供一个称为“解决方案导航器”的解决方案资源管理器替换项。它当前也硬编码为白色。但我认为,让该工具的开发人员添加对修改颜色的支持可能比让微软在Visual Studio中添加更好。(即使微软创建了PPT。)

        4
  •  4
  •   sharkin    13 年前

    不是通过任何方式从Visual Studio本身进行配置。

    但是,您可以从win32 api“黑客”该窗口对象(查看“窗口枚举”)。一旦你有了窗口句柄,你就可以设置你想要的所有特征。

    当做

    罗伯特

        5
  •  3
  •   Jacek    13 年前

    您可以使用其他扩展,您有很大的可能性使您的Visual Studio看起来更漂亮;(但我不确定是否可以更改解决方案资源管理器背景)

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