ToolWindow.ClientSize not working?

Docking/MDI for Windows Forms Forum

Posted 13 years ago by Gerard Laslett
Avatar
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
toolWindowSumSD.Activate(true);
would work - but it doesn't
help please.

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

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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;
t.Activate();


Actipro Software Support

Posted 13 years ago by Gerard Laslett
Avatar
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.

Cheers.
The latest build of this product (v2018.1 build 0341) was released 9 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.