当前位置: 首页>>代码示例>>C#>>正文


C# TextBoxBase.ScrollToCaret方法代码示例

本文整理汇总了C#中System.Windows.Forms.TextBoxBase.ScrollToCaret方法的典型用法代码示例。如果您正苦于以下问题:C# TextBoxBase.ScrollToCaret方法的具体用法?C# TextBoxBase.ScrollToCaret怎么用?C# TextBoxBase.ScrollToCaret使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TextBoxBase的用法示例。


在下文中一共展示了TextBoxBase.ScrollToCaret方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FindRegex

 internal static void FindRegex(TextBoxBase textBox, Regex regex)
 {
     Match match = regex.Match(textBox.Text, textBox.SelectionLength == 0 ? textBox.SelectionStart : textBox.SelectionStart + textBox.SelectionLength);
     if (!match.Success)
     {
         WikiPad.FindForm.ShowFormattedMessageBox("No further occurences of RegularExpression \"{0}\" have been found.", regex.ToString());
         return;
     }
     textBox.SelectionStart = match.Index;
     textBox.SelectionLength = match.Length;
     textBox.ScrollToCaret();
 }
开发者ID:Letractively,项目名称:schnell,代码行数:12,代码来源:ReplaceForm.cs

示例2: Find

        internal static void Find(TextBoxBase textBox, string findString, bool caseSensitive, bool upwards)
        {
            var comparison = caseSensitive
                           ? StringComparison.CurrentCulture
                           : StringComparison.CurrentCultureIgnoreCase;

            var text = textBox.Text;
            if (text.IndexOf(findString, comparison) == -1)
            {
                ShowFormattedMessageBox("Cannot find \"{0}\".", findString);
                return;
            }

            var foundIndex = Find(text, textBox.SelectionStart, textBox.SelectionLength, findString, comparison, upwards);
            if (foundIndex == -1)
            {
                ShowFormattedMessageBox("No further occurences of \"{0}\" have been found.", findString);
                return;
            }

            textBox.Select(foundIndex, findString.Length);
            textBox.ScrollToCaret();
        }
开发者ID:Letractively,项目名称:schnell,代码行数:23,代码来源:FindForm.cs

示例3: UpdateCaret

 /// <summary>
 /// Repositions the caret in the defined TextBox to position _caretPosition
 /// </summary>
 /// <param name="textBox">Textbox to update the caret position in</param>
 private void UpdateCaret(TextBoxBase textBox)
 {
     textBox.SelectionLength = 0;
     textBox.SelectionStart = _caretPosition;
     textBox.ScrollToCaret();
 }
开发者ID:mib-f8sm9c,项目名称:Cereal64,代码行数:10,代码来源:HexEditor.cs

示例4: DoSearch

    }//method

    private bool DoSearch(TextBoxBase textBox, string fragment, int start) {
      textBox.SelectionLength = 0;
      // Compile the regular expression.
      Regex r = new Regex(fragment, RegexOptions.IgnoreCase);
      // Match the regular expression pattern against a text string.
      Match m = r.Match(textBox.Text.Substring(start));
      if (m.Success) {
        int i = 0;
        Group g = m.Groups[i];
        CaptureCollection cc = g.Captures;
        Capture c = cc[0];
        textBox.SelectionStart = c.Index + start;
        textBox.SelectionLength = c.Length;
        textBox.Focus();
        textBox.ScrollToCaret();
        return true;
      }
      return false;
    }//method
开发者ID:androdev4u,项目名称:XLParser,代码行数:21,代码来源:fmGrammarExplorer.cs

示例5: SetCaretAt

 private static void SetCaretAt(TextBoxBase textBox, int position)
 {
     textBox.Focus();
     textBox.SelectionStart = position;
     textBox.SelectionLength = 0;
     textBox.ScrollToCaret();
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:RuleSetDialog.cs

示例6: ScrollToTop

 public static void ScrollToTop(TextBoxBase tb)
 {
     tb.SelectionStart = 0;
     tb.ScrollToCaret();
 }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:5,代码来源:SimpleTextbox.cs


注:本文中的System.Windows.Forms.TextBoxBase.ScrollToCaret方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。