Then, you have to create a button to open/close your dockable window :
[Guid("a048cbf6-e22b-4fa1-a803-b044d66e1b3e")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("DockCommand")]
public sealed class DockCommand : BaseCommand
{[INDENT]private static IApplication m_application;
private static IDockableWindow m_dockableWindow;
private const string DockableWindowGuid = "{74036c8c-fa64-41fa-bfcf-d261e24b641f}";
#region COM Registration Function(s)
[ComRegisterFunction()]
[ComVisible(false)]
static void RegisterFunction(Type registerType)
{
[/INDENT]
[INDENT=2]// Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType);[/INDENT]
[INDENT]}
[ComUnregisterFunction()]
[ComVisible(false)]
static void UnregisterFunction(Type registerType)
{
[/INDENT]
[INDENT=2]// Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType);[/INDENT]
[INDENT]}
#region ArcGIS Component Category Registrar generated code
private static void ArcGISCategoryRegistration(Type registerType)
{
[/INDENT]
[INDENT=2]string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
MxCommands.Register(regKey);[/INDENT]
[INDENT]}
private static void ArcGISCategoryUnregistration(Type registerType)
{
[/INDENT]
[INDENT=2]string regKey = string.Format("HKEY_CLASSES_ROOT\\CLSID\\{{{0}}}", registerType.GUID);
MxCommands.Unregister(regKey);[/INDENT]
[INDENT]}
#endregion
#endregion
public DockCommand()
{
[/INDENT]
[INDENT=2]base.m_enabled = true;
base.m_category = "bla bla"; //localizable text
base.m_caption = "bla bla bla"; //localizable text
base.m_message = "bla bla"; //localizable text
base.m_toolTip = "bla bla bla"; //localizable text
base.m_name = "bla bla bla"; //unique id, non-localizable (e.g. "MyCategory_ArcMapCommand")
[/INDENT]
[INDENT=2]
try
{
[/INDENT]
[INDENT=3]string bitmapResourceName = GetType().Name + ".bmp";
base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);[/INDENT]
[INDENT=2]}
catch (Exception ex)
{
[/INDENT]
[INDENT=3]System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");[/INDENT]
[INDENT=2]}[/INDENT]
[INDENT]}
#region Overriden Class Methods
public override void OnCreate(object hook)
{
[/INDENT]
[INDENT=2]if (hook != null)
[/INDENT]
[INDENT=3]m_application = hook as IApplication;[/INDENT]
[INDENT]}
public override void OnClick()
{
[/INDENT]
[INDENT=2]if (m_application == null)
[/INDENT]
[INDENT=3]base.m_enabled = false;[/INDENT]
[INDENT=2]
LaunchDock();[/INDENT]
[INDENT]}
public override bool Checked
{
[/INDENT]
[INDENT=2]get
{
[/INDENT]
[INDENT=3]return m_dockableWindow != null && m_dockableWindow.IsVisible();[/INDENT]
[INDENT=2]}[/INDENT]
[INDENT]}
#endregion
//Initialize the dockable window
private static void SetupDockableWindow()
{
[/INDENT]
[INDENT=2]if (m_dockableWindow == null)
{
[/INDENT]
[INDENT=3]IDockableWindowManager dockWindowManager = m_application as IDockableWindowManager;
if (dockWindowManager != null)
{
[/INDENT]
[INDENT=4]UID windowID = new UIDClass();
windowID.Value = DockableWindowGuid;
m_dockableWindow = dockWindowManager.GetDockableWindow(windowID);[/INDENT]
[INDENT=3]}[/INDENT]
[INDENT=2]}[/INDENT]
[INDENT]}
public static bool LaunchDock()
{
[/INDENT]
[INDENT=2]if(!this.Checked)
{
[/INDENT]
[INDENT=3]if (m_dockableWindow == null)
{
[/INDENT]
[INDENT=4]//start the form here : Form myForm = new MyForm();
//myForm.Show();
SetupDockableWindow();
m_dockableWindow.Show(true);[/INDENT]
[INDENT=3]}
else
{
[/INDENT]
[INDENT=4]m_dockableWindow.Show(true);[/INDENT]
[INDENT=3]}[/INDENT]
[INDENT=2]}
else
{
[/INDENT]
[INDENT=3]m_dockableWindow.Show(false);[/INDENT]
[INDENT=2]}[/INDENT]
[INDENT]}[/INDENT]
}