I have a paint box which I want the user to be able to undock and move around. So I set its DragKind to dkDock and its DragMode to dmAutomatic, and put it inside a panel with DockSite set to True. I’m experiencing a rather odd behavior when I dock the paint box after having undocked it to a floating form. The close button of the floating form appears inside the panel. I’ve attached two screenshots. One from the original state, and one after docking the paint box again. What am I missing?
Original State:

After docking:

UPDATE
After using TLama’s solution, here’s the result.

You’re not missing anything. That’s how the default dock manager implementation works. It just wants to have grabber with the close button available on dock site, which uses it. What you can do, is implement your own dock manager and override its
AdjustDockRectmethod, which controls the size of docking zone and where is in default dock manager implementation made a space for grabber with close button. If you don’t want that grabber, just keep the size of dock zone rectangle as it was passed to the method, in size of the whole dock site. In other words, do nothing in that method override.That’s for the functional part of the grabber, but except that you need to intercept hardcoded drawing of it. To do so, you need to override the
PaintDockFrameevent method and like before, do just nothing there.Here’s a code sample:
Here’s how to use such custom dock manager (see below for note about
UseDockManagerproperty):Important
As few sources suggest, you should set the
UseDockManagerproperty of your dock panel to False at design time. I don’t know why, but from quick tests I’ve made, some of the event methods of the custom dock manager were not fired when I didn’t have set that property at design time (theAdjustDockRectevent method worked properly even without doing so, but I wouldn’t personally rely on it).