FindText(String,Boolean,TextSearchMode,Boolean,Boolean) Метод (TextSelectionTool) 
 
            
                В этом разделе
            
            Ищет текстовую строку, начиная с текущей страницы.
            
            
Синтаксис
            
            
            
            
            'Declaration
Public Overloads Sub FindText( _
   ByVal  As System.String, _
   ByVal  As Boolean, _
   ByVal  As TextSearchMode, _
   ByVal  As Boolean, _
   ByVal  As Boolean _
)
 
            
            public void FindText(
   System.String , 
   bool , 
   TextSearchMode , 
   bool , 
   bool 
)
 
            
            public: void FindText(
   System.String , 
   bool , 
   TextSearchMode , 
   bool , 
   bool 
)
 
            
            public:
void FindText(
   System.String , 
   bool , 
   TextSearchMode , 
   bool , 
   bool 
)
 
             
	Parameters
- text
 
- Текст для поиска.
 
- ignoreCase
 
- Значение, указывающее, следует ли игнорировать чувствительность к регистру.
 
- searchMode
 
- Режим поиска текста.
 
- searchUp
 
- Значение, указывающее, следует ли искать текст с текущей позиции в документе до начала документа/страницы.
 
- searchFromStart
 
- Значение, указывающее, следует ли начинать поиск текста с начала.
 
         
Пример
    
	
	    
	    
Public Partial Class TextSearchForm
    Inherits System.Windows.Forms.Form
    ' ...
    Private _imageViewer As Vintasoft.Imaging.UI.ImageViewer = Nothing
    Private _textSelectionTool As Vintasoft.Imaging.UI.VisualTools.TextSelectionTool = Nothing
    Public Sub New()
        ' ...
        ' create the text selection tool
        _textSelectionTool = New Vintasoft.Imaging.UI.VisualTools.TextSelectionTool(New System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(56, System.Drawing.Color.Blue)))
        ' subscribe to the text selection tool events
        AddHandler _textSelectionTool.TextSearched, New System.EventHandler(Of Vintasoft.Imaging.Text.TextSearchedEventArgs)(AddressOf _textSelectionTool_TextSearched)
        ' sets the text selection tool as the current tool in image viewer
        _imageViewer.VisualTool = _textSelectionTool
    End Sub
    ''' <summary>
    ''' Starts the text search from the focused page in viewer.
    ''' </summary>
    Public Sub SearchText(text As String, newSearch As Boolean)
        ' specify that non case sensitive text must be searched
        Dim searchEngine As Vintasoft.Imaging.Text.TextSearchEngine = Vintasoft.Imaging.Text.TextSearchEngine.Create(text, True)
        ' find text in all pages
        _textSelectionTool.FindText(searchEngine, Vintasoft.Imaging.UI.VisualTools.TextSearchMode.AllPages, False, newSearch)
    End Sub
    ''' <summary>
    ''' Text is searched.
    ''' </summary>
    Private Sub _textSelectionTool_TextSearched(sender As Object, e As Vintasoft.Imaging.Text.TextSearchedEventArgs)
        ' if text is NOT found
        If e.FoundTextRegion Is Nothing Then
            System.Windows.Forms.MessageBox.Show(String.Format("The specified text is not found: {0}", e.SearchEngine))
        Else
            ' if text is found
            ' go to the page, where text is found
            _imageViewer.FocusedIndex = e.ImageIndex
            ' select the text region
            _textSelectionTool.SelectedRegion = e.FoundTextRegion
        End If
    End Sub
End Class
	     
	 
 
    
	
	    
	    
public partial class TextSearchForm : System.Windows.Forms.Form
{
    // ...
    Vintasoft.Imaging.UI.ImageViewer _imageViewer = null;
    Vintasoft.Imaging.UI.VisualTools.TextSelectionTool _textSelectionTool = null;
    public TextSearchForm()
    {
        // ...
        // create the text selection tool
        _textSelectionTool = new Vintasoft.Imaging.UI.VisualTools.TextSelectionTool(
            new System.Drawing.SolidBrush(
                System.Drawing.Color.FromArgb(56, System.Drawing.Color.Blue)));
        // subscribe to the text selection tool events
        _textSelectionTool.TextSearched +=
            new System.EventHandler<Vintasoft.Imaging.Text.TextSearchedEventArgs>(_textSelectionTool_TextSearched);
        // sets the text selection tool as the current tool in image viewer
        _imageViewer.VisualTool = _textSelectionTool;
    }
    /// <summary>
    /// Starts the text search from the focused page in viewer.
    /// </summary>
    public void SearchText(string text, bool newSearch)
    {
        // specify that non case sensitive text must be searched
        Vintasoft.Imaging.Text.TextSearchEngine searchEngine =
            Vintasoft.Imaging.Text.TextSearchEngine.Create(text, true);
        // find text in all pages
        _textSelectionTool.FindText(searchEngine,
            Vintasoft.Imaging.UI.VisualTools.TextSearchMode.AllPages, false, newSearch);
    }
    /// <summary>
    /// Text is searched.
    /// </summary>
    private void _textSelectionTool_TextSearched(object sender, Vintasoft.Imaging.Text.TextSearchedEventArgs e)
    {
        // if text is NOT found
        if (e.FoundTextRegion == null)
        {
            System.Windows.Forms.MessageBox.Show(string.Format("The specified text is not found: {0}", e.SearchEngine));
        }
        // if text is found
        else
        {
            // go to the page, where text is found
            _imageViewer.FocusedIndex = e.ImageIndex;
            // select the text region
            _textSelectionTool.SelectedRegion = e.FoundTextRegion;
        }
    }
}
	     
	 
 
 
Требования
Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
 
Смотрите также