RichTextBoxFinds 列挙体
この列挙体には、メンバ値のビットごとの組み合わせを可能にする FlagsAttribute 属性が含まれています。
名前空間: System.Windows.Formsアセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

<FlagsAttribute> _ Public Enumeration RichTextBoxFinds

メンバ名 | 説明 | |
---|---|---|
MatchCase | 大文字と小文字が正確である検索文字列のインスタンスだけを検索します。 | |
NoHighlight | 検索文字列は、見つかっても強調表示されません。 | |
None | 検索で見つかるインスタンスが検索文字列の語句に完全一致であるかどうかにかかわらず、検索文字列に一致するインスタンスをすべて検索します。 | |
Reverse | 検索はコントロールのドキュメントの末尾から開始され、先頭に向かって実行されます。 | |
WholeWord | 検索文字列の語句に完全一致するインスタンスだけを検索します。 |

アプリケーションでは、RichTextBox コントロールの Find メソッドを呼び出すことによって RichTextBox コントロール内の文字列を検索します。この列挙体を使用して、Find メソッドが呼び出されるときの検索方法を指定できます。この列挙体から 1 つ以上の値を組み合わせて、Find メソッドを呼び出すときの複数の検索オプションを指定できます。

RichTextBox の内容全体で文字列を検索し、最初に見つかった文字列をメソッドのテキスト パラメータに渡す例を次に示します。検索開始位置は、メソッドの start パラメータで指定します。RichTextBox 内で検索文字列が見つかると、見つかったテキストの最初の文字のインデックス位置が返され、見つかったテキストが強調表示されます。それ以外の場合は -1 の値が返されます。この例では、指定した検索文字列の大文字と小文字を一致させる検索オプションも指定されています。この例は、このメソッドが richTextBox1 という名前の RichTextBox を保持する Form のクラス内にあることを前提にしています。この例を使用して、検索テキストの最初のインスタンスが見つかったら、"Find Next" 入力操作を実行して、そのテキストのほかのインスタンスを検索できます。
Public Function FindMyText(text As String, start As Integer) As Integer ' Initialize the return value to false by default. Dim returnValue As Integer = - 1 ' Ensure that a search string has been specified and a valid start point. If text.Length > 0 And start >= 0 Then ' Obtain the location of the search string in richTextBox1. Dim indexToText As Integer = richTextBox1.Find(text, start, _ RichTextBoxFinds.MatchCase) ' Determine whether the text was found in richTextBox1. If indexToText >= 0 Then returnValue = indexToText End If End If Return returnValue End Function
public int FindMyText(string text, int start) { // Initialize the return value to false by default. int returnValue = -1; // Ensure that a search string has been specified and a valid start point. if (text.Length > 0 && start >= 0) { // Obtain the location of the search string in richTextBox1. int indexToText = richTextBox1.Find(text, start, RichTextBoxFinds.MatchCase); // Determine whether the text was found in richTextBox1. if(indexToText >= 0) { returnValue = indexToText; } } return returnValue; }
public: int FindMyText( String^ text, int start ) { // Initialize the return value to false by default. int returnValue = -1; // Ensure that a search string has been specified and a valid start point. if ( text->Length > 0 && start >= 0 ) { // Obtain the location of the search string in richTextBox1. int indexToText = richTextBox1->Find( text, start, RichTextBoxFinds::MatchCase ); // Determine whether the text was found in richTextBox1. if ( indexToText >= 0 ) { returnValue = indexToText; } } return returnValue; }
public int FindMyText(String text, int start) { // Initialize the return value to false by default. int returnValue = -1; // Ensure that a search string has been specified // and a valid start point. if (text.get_Length() > 0 && start >= 0) { // Obtain the location of the search string in richTextBox1. int indexToText = richTextBox1.Find(text, start, RichTextBoxFinds.MatchCase); // Determine whether the text was found in richTextBox1. if (indexToText >= 0) { returnValue = indexToText; } } return returnValue; } //FindMyText

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRichTextBoxFinds 列挙体を検索する場合は、下記のリンクをクリックしてください。

- RichTextBoxFinds 列挙体のページへのリンク