Visual Studio 2010 - Translucent Floating Windows

Is it possible to make floating windows translucent in Visual Studio 2010? I would like to be able to float the editor window and reduce the alpha level on it. Can this functionality be created with an extension that modifies the stock editor window?

If this is not an extension, are there any decent third-party applications that could modify the properties of specific child windows in Visual Studio 2010?

+7
visual-studio-2010 transparency
source share
2 answers

The main problem is that it depends on the tool window, because Visual Studio does not have much to do with how the tool window is rendered.

If the tool window has an HNWD for playback, you can set the transparency using the SetLayeredWindowAttributes function. If the tool window is WPF, you can use other tricks.

Now the problem is to grab onto something useful ... Just run SPY ++ on top of Visual Studio 2010 and you will see that there are not many visible HWNDs around HWND. Some packages use unmanaged code, some packages use .NET + Winforms, and more and more, recent packages use .NET + WPF.

UISpy (another spy tool, but based on UI Automation ) sees all the tool windows, but it doesn't display the Native WIndow Handle (one of the standard properties that UI Automation can read), which is not good news.

Visual Studio uses the IVsWindowPane interface and, in particular, the CreatePaneWindow method to create a host window, but there is nothing official to get HWND back to play with.

Hm! If you have a special tool window that you want to customize, we can have a deeper look, but it's hard for me to write a 100% general tool.

EDIT . I searched even more. Here is the code that lists all the windows (docked or floating) of the current instance of Visual Studio:

// WindowFrame needs Microsoft.VisualStudio.Platform.WindowManagement.dll public static IEnumerable<WindowFrame> EnumWindowFrames(Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp, __WindowFrameTypeFlags frameTypes) { if (sp == null) throw new ArgumentNullException("sp"); ServiceProvider serviceProvider = new ServiceProvider(sp); IVsUIShell4 shell = (IVsUIShell4)serviceProvider.GetService(typeof(SVsUIShell)); // VS 2010 only IEnumWindowFrames framesEnum; IVsWindowFrame[] frames = new IVsWindowFrame[1]; uint numFrames; shell.GetWindowEnum((uint)frameTypes, out framesEnum); if (framesEnum == null) yield break; while ((framesEnum.Next(1, frames, out numFrames) == VSConstants.S_OK) && (numFrames == 1)) { WindowFrame frame = frames[0] as WindowFrame; if (frame != null) yield return frame; } } 

This will give a list of instances of WindowFrame. WindowFrame is not documented, but it is publicly available (located in Microsoft.VisualStudio.Platform.WindowManagement.dll), so you can play with it. Each WindowFrame instance has a FrameView property that has a Content property. This Content property, in most cases, from my results, is a WPF Panel element. Then the hierarchy under this panel will depend on how the window actually runs.

If it is unmanaged or Winforms (for example, the .SQL editor), the collection of child panel elements will be HwndHost. I tried playing with it (using SetLayeredWindowAttributes ), but it does not work ...

If it's WPF (example, the new C # / VB editor), there will be a huge hiearchy WPF, which will eventually go to IWfpTextView . You can change many things in this hierarchy, and some of them will work (for example, the Background property), but ... as for transparency, I don’t think it is possible because the root window does not allow it (it has AllowTransparency set to false, and it cannot be changed after it is displayed). For example, setting Opacity = 0.5 works, but since there is no transparency, the effect is only dim windows ...

+5
source share

Have you checked the Visual Studio Color Theme Editor ? If it does not do what you need, perhaps you can request this function from the author.

0
source share

All Articles