本文整理汇总了C#中System.Windows.Forms.RichTextBox.Undo方法的典型用法代码示例。如果您正苦于以下问题:C# RichTextBox.Undo方法的具体用法?C# RichTextBox.Undo怎么用?C# RichTextBox.Undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.RichTextBox
的用法示例。
在下文中一共展示了RichTextBox.Undo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindMyText
public int FindMyText(string txtToSearch, int searchStart, int searchEnd,RichTextBox rtb)
{
// Unselect the previously searched string
if (searchStart > 0 && searchEnd > 0 && indexOfSearchText >= 0)
{
rtb.Undo();
}
// Set the return value to -1 by default.
int retVal = -1;
// A valid starting index should be specified.
// if indexOfSearchText = -1, the end of search
if (searchStart >= 0 && indexOfSearchText >= 0)
{
// A valid ending index
if (searchEnd > searchStart || searchEnd == -1)
{
// Find the position of search string in RichTextBox
indexOfSearchText = rtb.Find(txtToSearch, searchStart, searchEnd, RichTextBoxFinds.None);
// Determine whether the text was found in richTextBox1.
if (indexOfSearchText != -1)
{
// Return the index to the specified search text.
retVal = indexOfSearchText;
}
}
}
return retVal;
}
示例2: UndoAction
private void UndoAction(RichTextBox myRtb)
{
while (myRtb.CanUndo)
{
myRtb.Undo();
// Clear the undo buffer to prevent last action from being
myRtb.ClearUndo();
}
}
示例3: GetCurrentRichTextBox
public void 撤销ToolStripMenuItem_Click(object sender, EventArgs e)
{
r = GetCurrentRichTextBox();
r.Undo();
}