当我们处理undo(`ctrl + z`)时,从哪里复制值?

时间:2014-08-28 12:54:07

标签: vb.net windows clipboard undo

我有疑问,当我们处理撤消(ctrl+z)时,值的复制位置是什么?价值暂时持有的地方?它不在clipboard中,而是clipboardbuffer

对于文本框,我可以使用堆栈设置100后退undo operation。以下是vb.net中此实现的代码:

    Dim undoStack(100) As String ' stack array
    Dim stackTop As Integer = 0 ' stack counter
    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If stackTop < 100 Then ' 100 step back undoStack
            ' system will perform the operation when use ctrl+z for undoStack
            ' so i choose f1 key for undoStack to check the code
            If e.KeyCode = Keys.F1 And stackTop > 0 Then ' check whether the key is F1 and stack is empty or not
                TextBox1.Text = undoStack(stackTop - 1) 'load lst change to the text box from stack
                undoStack(stackTop) = Nothing ' clear the stack top value
                stackTop -= 1 ' decrement the stack top by 1
            ElseIf TextBox1.Text <> undoStack(stackTop) Then
                undoStack(stackTop) = TextBox1.Text ' push value to stackTop
                stackTop += 1 'Increment the stackTop
            End If
        Else
            ' call function to perform left shift
            ' insert change in last position
        End If
    End Sub

希望在系统中他们必须是这样一个机制。 我知道吗

  • Windows buffer/stack
  • undo Operation名称是什么?
  • 是否可以通过vb.net
  • clipboard代码访问

注意:代码不完整,但它可以按照我的意愿运行。

0 个答案:

没有答案