微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

VB.Net程序设计:辅助代码段1

自己备忘。

        Dim tbl As DataTable = GetFullPackLotList(order.ShipOrderID)
        For Each row As DaTarow In tbl.Rows
            Debug.Print(row.Item(TBC.strLotNo))
        Next
        Dim _mcc As Collection = (New NF.ShipOrderPackBox).Fill(Me.GetShipOrderPackBoxList(order.ShipOrderID))
        If _mcc.Count > 0 Then
            For i As Integer = 1 To _mcc.Count
                Debug.Print(CType(_mcc.Item(i),NF.ShipOrderPackBox).LotNo)
            Next
        End If


    Private Function BoxTB(ByVal tb As DataTable) As DataTable
        Dim tbNew As New DataTable
        tbNew = tb.copy
        tbNew.Columns.Add("类别",GetType(String),"iif(" & TBC.lngHaltType & "=1,'全部','部份')")
        tbNew.Columns.Add("模式","iif(" & TBC.lngHaltProductionMode & "=1,'推','延')")
        tbNew.Columns("类别").Setordinal(2)
        tbNew.Columns("模式").Setordinal(7)
        Return tbNew
    End Function

 Private Sub Dv_MouseMove(ByVal sender As Object,ByVal e As System.Windows.Forms.MouseEventArgs) Handles Dv.MouseMove
        If (e.Button And Windows.Forms.MouseButtons.Left) <> Windows.Forms.MouseButtons.Left Then Return
        Dim ht As DataGridView.HitTestInfo
        Dim obj As DataGridView = CType(sender,DataGridView)
        ht = obj.HitTest(e.X,e.Y)
        If ht.Type <> DataGridViewHitTestType.Cell Then Return
        If Control.ModifierKeys = Keys.Control Then
            dragData = New DragDataObject(eDragType.MoveXRowToOtherXRow,obj.SelectedRows)
            obj.DoDragDrop(dragData,DragDropEffects.All)
            'OnRowDragOver(-1)
        Else
            dragData = New DragDataObject(eDragType.MoveOrderToXRow,DragDropEffects.All)
            'OnRowDragOver(-1)
        End If
    End Sub

    Private Sub Dv_RowPostPaint(ByVal sender As Object,ByVal e As System.Windows.Forms.DataGridViewRowPostPaintEventArgs) Handles Dv.RowPostPaint
        If e.RowIndex = indexOfItemUnderMouSEOver Then
            e.Graphics.DrawRectangle(Pens.Red,e.RowBounds.X,e.RowBounds.Y,e.RowBounds.Width - 1,e.RowBounds.Height - 1)
        End If
    End Sub

    Private Sub OnRowDragOver(ByVal rowIndex As Integer)
        If (indexOfItemUnderMouSEOver = rowIndex) Then Return
        Dim old As Integer = indexOfItemUnderMouSEOver
        indexOfItemUnderMouSEOver = rowIndex
        If (old > -1) Then Me.DgvPlanAll.InvalidateRow(old)
        If (rowIndex > -1) Then Me.DgvPlanAll.InvalidateRow(rowIndex)
    End Sub
#Region "--XRow拖放操作--"

    Private Sub XpTableLots_MouseMove(ByVal sender As Object,ByVal e As System.Windows.Forms.MouseEventArgs) Handles XpTableLots.MouseMove
        If e.Button = Windows.Forms.MouseButtons.Left Then
            With Me.XpTableLots
                If .Selectedindicies.Length > 0 Then
                    Dim drg As DragDataObject = New DragDataObject(eDragType.MoveBoxXRowToDv,.TableModel.Rows(.Selectedindicies(0)))
                    .DoDragDrop(drg,DragDropEffects.All)
                End If
            End With
        End If
    End Sub

    Private Sub XpTableLots_DragOver(ByVal sender As Object,ByVal e As System.Windows.Forms.DragEventArgs) Handles XpTableLots.DragOver
        If e.Data.GetDataPresent(GetType(DragDataObject)) Then
            Dim drg As DragDataObject
            drg = e.Data.GetData(GetType(DragDataObject))
            If drg.DragType = eDragType.MoveBoxDvToXRowFull OrElse drg.DragType = eDragType.MoveBoxDvToXRowMerge Then
                e.Effect = DragDropEffects.Move
            Else
                e.Effect = DragDropEffects.None
            End If
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub

    Private Sub XpTableLots_DragDrop(ByVal sender As Object,ByVal e As System.Windows.Forms.DragEventArgs) Handles XpTableLots.DragDrop
        If e.Data.GetDataPresent(GetType(DragDataObject)) Then
            Dim drg As DragDataObject
            drg = e.Data.GetData(GetType(DragDataObject))
            If drg.DragType = eDragType.MoveBoxDvToXRowFull OrElse drg.DragType = eDragType.MoveBoxDvToXRowMerge Then
                xRow = CType(drg.Data,XPTable.Models.Row)
                ChangeLotSumQty(xRow.Cells(eBoxCol.LotNo).Text,xRow.Cells(eBoxCol.SumQty).Data)
                xRow.TableModel.Table.TableModel.Rows.Remove(xRow)
                CalcutlateXPSumQty()
            End If
        End If
    End Sub

#End Region

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐