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

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...