markdown DevExpress Tab重新排序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown DevExpress Tab重新排序相关的知识,希望对你有一定的参考价值。

Tab Reorder

DevExpress.XtraTab.ExtraTabControl

Note: this does not work with the TabPane control.

Add these references

    Imports DevExpress.XtraTab
    Imports DevExpress.XtraTab.ViewInfo

Add these class variables

    Private mPoint As System.Drawing.Point = System.Drawing.Point.Empty
    Private mPage As XtraTabPage = Nothing

For the XtraTabControl, add the following code to the MouseDown, MouseMove, and DragOver event handlers

    Private Sub xtcService_MouseDown(sender As Object, e As MouseEventArgs) Handles xtcService.MouseDown
        Dim c As XtraTabControl = TryCast(sender, XtraTabControl)
        mPoint = New System.Drawing.Point(e.X, e.Y)
        Dim hi As XtraTabHitInfo = c.CalcHitInfo(mPoint)
        mPage = hi.Page
        If hi.Page Is Nothing Then mPoint = Point.Empty
    End Sub

    Private Sub xtcService_MouseMove(sender As Object, e As MouseEventArgs) Handles xtcService.MouseMove
        If e.Button = MouseButtons.Left Then
            If (mPoint <> Point.Empty) AndAlso ((Math.Abs(e.X - mPoint.X) > SystemInformation.DragSize.Width) OrElse (Math.Abs(e.Y - mPoint.Y) > SystemInformation.DragSize.Height)) Then xtcService.DoDragDrop(sender, DragDropEffects.Move)
        End If
    End Sub

    Private Sub xtcService_DragOver(sender As Object, e As DragEventArgs) Handles xtcService.DragOver
        Dim c As XtraTabControl = TryCast(sender, XtraTabControl)
        If c Is Nothing Then Return
        Dim hi As XtraTabHitInfo = c.CalcHitInfo(c.PointToClient(New Point(e.X, e.Y)))
        If hi.Page IsNot Nothing Then
            If hi.Page IsNot mPage Then
                If c.TabPages.IndexOf(hi.Page) < c.TabPages.IndexOf(mPage) Then c.TabPages.Move(c.TabPages.IndexOf(hi.Page), mPage) Else c.TabPages.Move(c.TabPages.IndexOf(hi.Page) + 1, mPage)
            End If

            e.Effect = DragDropEffects.Move
        Else
            e.Effect = DragDropEffects.None
        End If

    End Sub

以上是关于markdown DevExpress Tab重新排序的主要内容,如果未能解决你的问题,请参考以下文章