SpreadForWin 复制粘贴,剪切行
Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click
Dim aCol As Integer, aRow As Integer
aCol = ssList.ActiveSheet.ActiveColumnIndex
aRow = ssList.ActiveSheet.ActiveRowIndex
ssList.Focus()
ssList.ActiveSheet.SetActiveCell(aRow, -1)
SendKeys.Send("^c")
End Sub
Private Sub btnPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPaste.Click
Dim aCol As Integer, aRow As Integer
aCol = ssList.ActiveSheet.ActiveColumnIndex
aRow = ssList.ActiveSheet.ActiveRowIndex
ssList.Focus()
ssList.ActiveSheet.SetActiveCell(aRow, -1)
SendKeys.Send("^v")
End Sub
Private Sub btnCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCut.Click
Dim aCol As Integer, aRow As Integer
aCol = ssList.ActiveSheet.ActiveColumnIndex
aRow = ssList.ActiveSheet.ActiveRowIndex
ssList.Focus()
ssList.ActiveSheet.SetActiveCell(aRow, -1)
SendKeys.Send("^x")
End Sub
Private CopyRow As Integer
Private isCopyRange As Boolean
Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click
CopyRow = ssList.ActiveSheet.ActiveRowIndex
isCopyRange = False
With ssList
.ActiveSheet.ClipboardCopy()
End With
End Sub
Private Sub btnPatse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPatse.Click
Dim aCol As Integer, aRow As Integer
aCol = ssList.ActiveSheet.ActiveColumnIndex
aRow = ssList.ActiveSheet.ActiveRowIndex
If isCopyRange Then
ssList.ActiveSheet.CopyRange(CopyRow, 0, aRow, aCol, 1, ssList.ActiveSheet.ColumnCount, True)
Else
ssList.ActiveSheet.ClipboardPaste()
isCopyRange = True
End If
End Sub
Private Sub btnCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCut.Click
isCopyRange = False
ssList.ActiveSheet.ClipboardCut()
End Sub
Private isCopyRange As Boolean
Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click
CopyRow = ssList.ActiveSheet.ActiveRowIndex
isCopyRange = False
With ssList
.ActiveSheet.ClipboardCopy()
End With
End Sub
Private Sub btnPatse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPatse.Click
Dim aCol As Integer, aRow As Integer
aCol = ssList.ActiveSheet.ActiveColumnIndex
aRow = ssList.ActiveSheet.ActiveRowIndex
If isCopyRange Then
ssList.ActiveSheet.CopyRange(CopyRow, 0, aRow, aCol, 1, ssList.ActiveSheet.ColumnCount, True)
Else
ssList.ActiveSheet.ClipboardPaste()
isCopyRange = True
End If
End Sub
Private Sub btnCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCut.Click
isCopyRange = False
ssList.ActiveSheet.ClipboardCut()
End Sub
本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。 |