Home Forums WinForms controls Other WinForms controls Toolwindow DockLayoutmanager width… Reply To: Toolwindow DockLayoutmanager width…

User (Old forums)
Member
Post count: 23064

Hi I would like to know if there is a solution for this. I can not spawn off a separate thread just for handling this. I “Dock” one of my controls, and it splits it 50/50 with the other control that i’ve added. Using the code above, if I open up the app and undock it, and then redock it, it now works. But the initial state is 50/50 which I do not want:

 

 private void Engine_Load(object sender, EventArgs e)
        {
            ToolWindow conversations = new ToolWindow(m_ConversationWindow, “ConversationWindow”);
            conversations.Key = “ConversationWindow”;
            conversations.Text = “Conversations”;
            conversations.StateChanged += new EventHandler(ConversationWindow_StateChanged);
            conversations.State = ToolWindowState.Docked;
            conversations.MinimumSize = new Size(m_Console.MinimumWidth, m_Console.MinimumHeight);

            ToolWindow console = new ToolWindow(m_Console, “Console”);
            console.State = ToolWindowState.Docked;
            console.Key = “Console”;
            console.Text = “Console”;

            m_DockLayoutManager.SuspendLayout();
            m_DockLayoutManager.ToolWindows.Add(conversations);
            m_DockLayoutManager.ToolWindows.Add(console);
            conversations.DockTo(console, DockPosition.Right);
            m_DockLayoutManager.ResumeLayout();
        }

        private void ConversationWindow_StateChanged(object sender, EventArgs e)
        {
            ToolWindow window = (ToolWindow)sender;

            if (window.State == ToolWindowState.Docked)
            {
                window.Width = this.Width – m_Console.MinimumWidth;
            }
        }

Imported from legacy forums. Posted by Raymond (had 414 views)