none
VS 2019 - transparent ToolWindowPane with WinForms control RRS feed

  • Question

  • 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.

    Tuesday, July 9, 2019 10:22 AM

All replies

  • Unfortunately I can not add attachments until my account is verified...
    Tuesday, July 9, 2019 10:22 AM
  • I found the reason:

    This is related to new feature "Per Monitor Awareness". A description of this problem can be found on JetBrains blog: https://blog.jetbrains.com/dotnet/2019/06/11/blank-tool-windows-resharper-visual-studio-2019-net-framework-4-8-per-monitor-dpi-awareness/

    The easiest fix(?) for .net can be found in MS blog: https://devblogs.microsoft.com/visualstudio/new-features-for-extension-authors-in-visual-studio-2019-version-16-1/

    Wednesday, July 10, 2019 7:05 AM
  • Hi pkruk,

    Welcome to MSDN forum.

    It seems this issue is solved. Thanks for sharing the details info about this. You can mark it as accepted answer(You can find the button below your useful reply) so that this issue will appear in our forum as  Solved to help members with similar issue easily find these useful info. 

    And since it seems to be a workaround, you can still follow the status in Developer Community, that's where we report issues about IDE itself. 

    Thanks for your understanding. Have a nice day!

    Sincerely

    Lance


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Wednesday, July 10, 2019 9:00 AM