Version

TabDragOver Event

Event that occurs during the drag of an MdiTab to determine if the specified location is a valid drop point.
Syntax
'Declaration
 
Public Event TabDragOver As MdiTabDragOverEventHandler
public event MdiTabDragOverEventHandler TabDragOver
Event Data

The event handler receives an argument of type MdiTabDragOverEventArgs containing data related to this event. The following MdiTabDragOverEventArgs properties provide information specific to this event.

PropertyDescription
AllowDrop Returns or sets whether the Tab may be dropped at this location
DragCursor Returns or sets the System.Windows.Forms.Cursor to display at this location. Leave this set to null to show the default cursor.
DropAction Returns the action that will be taken if the mouse is released at this location.
Orientation Returns the orientation of the new group.
Point Returns the location of the mouse, in screen coordinates, that is being processed.
RelativePosition Returns the position of the new group with respect to the TabGroup.
Tab Returns the MdiTab being dragged
TabGroup Returns the MdiTabGroup that the Tab is being dragged over or null if the mouse is not over a TabGroup
Remarks

The TabDragOver event is invoked during a Tab drag operation when the mouse is positioned over a valid drop location. The MdiTabDragOverEventArgs.AllowDrop can be set to true to indicate to the end user that this location is not a valid drop point. Also, the cursor displayed may be initialized using the MdiTabDragOverEventArgs.DragCursor. The DropAction indicates the action that will be taken if the tab is released at this MdiTabDragOverEventArgs.Point.

Example
The following sample demonstrates how to use the information passed to the TabDragOver event.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinTabs
Imports Infragistics.Win.UltraWinTabbedMdi

Private Sub ultraTabbedMdiManager1_TabDragOver(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabbedMdi.MdiTabDragOverEventArgs) Handles ultraTabbedMdiManager1.TabDragOver
    ' The 'TabDragOver' event is invoked during a drag operation
    ' as the mouse is repositioned. The 'DropAction' indicates
    ' the action that will be taken if the mouse is released
    ' at this point.
    '

    Select Case e.DropAction
        Case MdiTabDropAction.TabGroup
            ' if the tab came from another tab group
            ' is attempting to drag it over an edit group,
            ' then prevent the drop
            If Not e.TabGroup Is e.Tab.TabGroup AndAlso e.TabGroup.Key = "Edit" Then
                ' The 'AllowDrop' may be set to false to indicate
                ' that the specified point is not a valid drop location.
                e.AllowDrop = False

                ' The 'DragCursor' may be used to show a specific cursor 
                ' for the 'Point' being processed.
                e.DragCursor = Cursors.No
            End If
            Exit Sub
        Case MdiTabDropAction.NewHorizontalGroup
        Case MdiTabDropAction.NewVerticalGroup
            ' the point must be over a splitter bar
            ' or near the edge of the mdi client area
            Exit Sub
        Case MdiTabDropAction.ContextMenu
            ' prevent the display of a context menu if
            ' the mouse is released within the mdi client area
            e.AllowDrop = False
            Exit Sub
    End Select
End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinTabs;
using Infragistics.Win.UltraWinTabbedMdi;

private void ultraTabbedMdiManager1_TabDragOver(object sender, Infragistics.Win.UltraWinTabbedMdi.MdiTabDragOverEventArgs e)
{
	// The 'TabDragOver' event is invoked during a drag operation
	// as the mouse is repositioned. The 'DropAction' indicates
	// the action that will be taken if the mouse is released
	// at this point.
	//

	switch(e.DropAction)
	{
		case MdiTabDropAction.TabGroup:
		{
			// if the tab came from another tab group
			// is attempting to drag it over an edit group,
			// then prevent the drop
			if (e.TabGroup != e.Tab.TabGroup && 
				e.TabGroup.Key == "Edit")
			{
				// The 'AllowDrop' may be set to false to indicate
				// that the specified point is not a valid drop location.
				e.AllowDrop = false;

				// The 'DragCursor' may be used to show a specific cursor 
				// for the 'Point' being processed.
				e.DragCursor = Cursors.No;
			}
			break;
		}
		case MdiTabDropAction.NewHorizontalGroup:
		case MdiTabDropAction.NewVerticalGroup:
			// the point must be over a splitter bar
			// or near the edge of the mdi client area
			break;
		case MdiTabDropAction.ContextMenu:
			// prevent the display of a context menu if
			// the mouse is released within the mdi client area
			e.AllowDrop = false;
			break;
	}
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also