Hi,
I have a problem with tool window with a WinForms control, in VS 2019. I have in fact posted to VS developer community forum too ("VS 2019 regression - transparent ToolWindowPane with WinForms control") but maybe I can get help here too?
In short, I'm unable to get WinForms to work as the content of ToolWindowPane in VS 2019 :( In VS 2017 or earlier it worked, in VS 2019 the window is transparent. Any ideas?
Let me copy my post from VS developer community forum:
I have a code which creates custom ToolWindowPane with WinForms control (not WPF).
The code worked in previous VS versions (VS 2017 and earlier) but stopped working in VS 2019.
I am attaching a minimal repro and screenshots which show the problem. How to use:
1. open VSIXProject3.sln, compile
2. start in VS 2017 instance, show the window (View > Other Windows > ToolWindow1), notice that the "Click Me" button is visible
3. start in VS 2019 instance, show the window, notice that the window is "transparent", the button is not visible
Notes:
1. the attached project was created using VS 2017 wizard for vsix project, then a new "Custom Tool Window" was added, then a new "Windows Forms>User Control" was added and used instead of automatically generated WPF xaml control. See
the ToolWindow1.cs for the code.
2. the code creates control in constructor but does not assign it to "Content" but returns it from the "Window" property. Assigning to Content didn't work and returning the control from Window is a workaround which worked previously (VS
2017 and earlier). It is described in https://www.mztools.com/articles/2014/MZ2014015.aspx
3. I found another workaround - creating control not in constructor, but in the "Window" directly. It helps in this simple case, although it does not help in more complex case (not described in this problem report). But I think constructing the control
in "Window" property is not the correct way?
4. I also tried constructing the control in other methods like Initialize, OnCreate, OnToolWindowCreated, but it didn't work too.
Thanks.