简体   繁体   中英

How to hide/show the tool window but not close it

I have a VS2010 Isolated Shell application and I have a tool window as below

public class MyWindow : ToolWindowPane

And this tool window supports multiple instance

    [ProvideToolWindow(typeof (MyWindow ),
        MultiInstances = true,
        Style = VsDockStyle.MDI,
        Transient = true)]
 public sealed class MyVsxPackage : Package

Then in my application I can open more than one tool window (each tool window has its own window Id), but when I close one of them I just want to hide it, and next time when I reopen the window the settings on the window should keep the same before it was closed, how to handle this?

In another words, my question is: is there any way that prevent the multiple instance tool window from being closed by click the 'x' button (just hide it)?

Thanks in advance!

I supposed you have a list of toolbars with toolbars created in your App. You must have a method in your toolbar that hides/show it. (If you don't really close toolbars, don't call close method). When you "close" a toolbar call hide method, when reopen call show. (When close App, call close).

Hope this help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM