OnDragEnter doesn't fire on empty TabControl

  • Thread starter Thread starter Francois Vanderseypen
  • Start date Start date
F

Francois Vanderseypen

Can someone tell me why you cannot drag something onto a tabcontrol
with zero tabpages? I have a kind of 'docking' interface and relies
heavily on GDI+, a screenshot is available here:

http://netron.sourceforge.net/Biotron3Shot.jpg

You can move tab pages in the different panes, unless it's totally
empty (TabCount=0). Is there an alternative?

Thanks a lot,
Swa

[The Netron Project, http://netron.sf.net]
 
Hello Swa,
About the TabControl in MSDN document, the description you can see is below:
Note The following events are not raised for the TabControl class unless
there is at least one TabPage in the TabControl.TabPages collection:
Control.Click, Control.DoubleClick, Control.MouseDown, Control.MouseUp,
Control.MouseHover, Control.MouseEnter, Control.MouseLeave and
Control.MouseMove. If there is at least one TabPage in the collection, and
the user interacts with the tab control's header (where the TabPage names
appear), the TabControl raises the appropriate event. However, if the user
interaction is within the ClientRectangle of the tab page, the TabPage
raises the appropriate event.
 
The TabControl is all Non-Client Area.
WM_NCHITTEST returns HTTRANSPARENT when there is no Tab in the area under
the mouse, so the Tabcontrol does not receive these Mouse events. They are
passed to the underlying control.

To test this just add an eventhandler for Form.Click (assuming the form is
the tabcontrols container) and you will find it fires when you click on the
TabControl.

I haven't tested it, but I would think you can do your dragdrop on the form
(or what ever control is the tabcontrols container) and test whether the
drop point is within the bounds of the tabcontrol.
 
Back
Top