Example





In This Topic
GdPicture14.WPF Namespace / GdViewer Class / EnableTextSelection Property

EnableTextSelection Property (GdViewer)

In This Topic
Specifies if text selection is enabled in the GdViewer control, that means, for example, also the ability to copy text from the currently displayed page of the text-based document.

The line selection mode is used by default, holding the Alt-key during selection permits you to switch to the column selection mode.

Syntax
'Declaration
 
Public Property EnableTextSelection As Boolean
public bool EnableTextSelection {get; set;}
public read-write property EnableTextSelection: Boolean; 
public function get,set EnableTextSelection : boolean
public: __property bool get_EnableTextSelection();
public: __property void set_EnableTextSelection( 
   bool value
);
public:
property bool EnableTextSelection {
   bool get();
   void set (    bool value);
}

Property Value

The default value is true.
Remarks
Please note that you can switch from the line selection mode used by default to the column selection mode holding the Alt-key during selection.
Example
How to select all text on the currently displayed page in the viewer, how to extract it and how to clear the selection.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    'Enabling text selection.
    GdViewer1.EnableTextSelection = True
    If GdViewer1.SelectAllText() = GdPictureStatus.OK Then
        Dim selected_text As String = GdViewer1.GetSelectedText()
        If GdViewer1.GetStat() = GdPictureStatus.OK Then
            'Do your stuff with the page_text.
            GdViewer1.ClearSelectedText()
        Else
            MessageBox.Show("The text can't be extracted. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText")
        End If
    Else
        MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText")
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    //Enabling text selection.
    GdViewer1.EnableTextSelection = true;
    if (GdViewer1.SelectAllText() == GdPictureStatus.OK)
    {
        string selected_text = GdViewer1.GetSelectedText();
        if (GdViewer1.GetStat() == GdPictureStatus.OK)
        {
            //Do your stuff with the selected_text.
            GdViewer1.ClearSelectedText();
        }
        else
            MessageBox.Show("The text can't be extracted. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText");
    }
    else
        MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText");
}
else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SelectAllText");
See Also