ToolWindow.ClientSize not working?

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Gerard Laslett
ToolWindow.ClientSize not working?

I have a ToolWindow, that is floating (only).
It was created around a fixed sized custom usercontrol.

How do I make the ToolWindow floating dimensions such that it shows the usercontrol completely.

The ClientSize property on the ToolWindow object doesnt seem to work properly.
I would have though writing code like this:
Control tool = new Tools.NsSumSdTool();
ToolWindow toolWindowSumSD = new ToolWindow(this.DockManager, "tool_SumSD", "SumSD", null, tool);
toolWindowSumSD.State = ToolWindowState.Floating;
toolWindowSumSD.ClientSize = tool.Size
would work - but it doesn't
help please.

[Modified at 06/14/2006 02:18 AM]

Comments (2)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
ClientSize is something that Microsoft has on the Control class so it doesn't do anything related to tool windows.
Here's some quick and dirty code that will make a floating tool window fit a Button.
Button b = new Button();
ToolWindow t = new ToolWindow(dockManager, "test", "test", null, b);
b.Dock = DockStyle.None;
b.Size = new Size(80, 28);
t.FloatingSize = new Size(
    SystemInformation.FrameBorderSize.Width * 2 + b.Width,
    SystemInformation.ToolWindowCaptionHeight + SystemInformation.FrameBorderSize.Height * 2 + b.Height
t.State = ToolWindowState.Floating;

Actipro Software Support

Posted 18 years ago by Gerard Laslett
Ahh - ok - thanks for that.

I'd done the following
Form hostForm = toolWindow.FindForm();
hostForm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
hostForm.ClientSize = new System.Drawing.Size(225, 69);
Note: I also needed to make it not sizable.
I might try yours, as it doesn't need to be activated (hence the surrounding window created) before setting the size.

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.