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("模式", GetType(String), "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, obj.SelectedRows)
            obj.DoDragDrop(dragData, 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




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值