User (Old forums)MemberFebruary 13, 2007 at 9:12 amPost count: 23064
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.
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.
Imported from legacy forums. Posted by toedwy (had 6001 views)User (Old forums)MemberFebruary 13, 2007 at 2:48 pmPost count: 23064
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)User (Old forums)MemberFebruary 15, 2007 at 12:58 pmPost count: 23064
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.
Imported from legacy forums. Posted by toedwy (had 3529 views)User (Old forums)MemberJanuary 5, 2009 at 4:30 pmPost 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”;
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)User (Old forums)MemberJanuary 13, 2009 at 12:05 pmPost count: 23064
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)
- You must be logged in to reply to this topic.