Home › Forums › WinForms controls › Other WinForms controls › Toolwindow DockLayoutmanager width…
-
AuthorPosts
-
#18232 |
Gentlemen, Gentleladies…
I am having difficulty setting the Toolwindow width. I have a groupbox that I set a width to 350. I then create a toolwindow passing this groupbox as a parameter.
i.e.
ToolWindow twParameters = new ToolWindow( gbParameters, “Parameters” );
twParameters.Width = 350;
_layoutManager.ToolWindows.Add( twParameters );
However, whenever I then load the form, the toolwindow is a designated size of approximately 200. How can I force the size to be what I require?
Thanks for any help.
Matt
Imported from legacy forums. Posted by toedwy (had 6001 views)
Can you look at the following http://forums.xceed.com/forums/ShowPost.aspx?PostID=4263, and verify if it solves your issue?
Imported from legacy forums. Posted by André (had 351 views)
AndreC,
Thank you for the response.
Yes, I should have stated I found the thread you linked and still had difficulties. While the StateChanged event did fire when I added the toolwindow to the layoutmanager, it had no effect on the width.
I was able to get it to work only when I spun off the Statechanged event on a seperate thread.
I am not sure this is the most elegant answer, but it works for now.
Thanks again,
Matt
Imported from legacy forums. Posted by toedwy (had 3529 views)
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)
Is the Engine_Load event the Form_Load event? If not, it may explain why it does not work. That is, if the form is not loaded at the time the StateChanged event is triggered, it will not work. So make sure your code is run at or after the form is loaded.
However, we have come across a scenario where the SuspendLayout() call interfered with the original layout, so you might have to remove it. You might also need to remove the MinimumSize assignment.
Imported from legacy forums. Posted by André (had 4276 views)
-
AuthorPosts
- You must be logged in to reply to this topic.