Dock Your Forms

This sample shows how to dock your forms to the edges of your main form. The child form can float or be docked to any of the four edges. It also shows how to create ToolBar windows and ToolTip windows.

Create toolbar forms that can be docked to your main form Create toolbar forms that can be docked to your main form
Download Source Code

Description

This sample gets a bit involved and I'll leave most of the details to the code. In general,  A ToolBar Window is created to display images representing a controls menu. Tooltip windows are created to display tooltips denoting the names of the controls the cursor is hovering over. In real life you want real controls and not images but the docking concept is the same. The window displaying the forms is set to be a child of the main window and is subclassed to receive and handle various Window's messages. The child window is positioned and sized corresponding to the edge it is docked to.

Instructions

Download the source code and run it. Right click on the child forms caption to display its menu. Dock the form to the desired edge. Then you can use its title bar to drag it to the center of the form to make it float.




About TheScarms
About TheScarms


Sample code
version info

If you use this code, please mention "www.TheScarms.com"

Email this page


© Copyright 2024 TheScarms
Goto top of page