'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim text_to_find As String = "GdPicture"
GdViewer1.RemoveAllRegions()
Dim text_found As Boolean = GdViewer1.SearchText(text_to_find, 0, True)
If GdViewer1.GetStat() = GdPictureStatus.OK Then
If text_found AndAlso (GdViewer1.RegionCount() > 0) Then
'The first region surely exists.
Dim regID As Integer = GdViewer1.GetRegionID(1)
GdViewer1.EnsureRegionVisibility(regID)
GdViewer1.SetRegionSelected(regID, True)
Else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionSelected")
End If
Else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionSelected")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionSelected")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
string text_to_find = "GdPicture";
GdViewer1.RemoveAllRegions();
bool text_found = GdViewer1.SearchText(text_to_find, 0, true);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
if (text_found && (GdViewer1.RegionCount() > 0))
{
//The first region surely exists.
int regID = GdViewer1.GetRegionID(1);
GdViewer1.EnsureRegionVisibility(regID);
GdViewer1.SetRegionSelected(regID, true);
}
else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionSelected");
}
else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionSelected");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionSelected");