'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 Then
'The first region surely exists.
Dim regID As Integer = GdViewer1.GetRegionID(1)
GdViewer1.DisplayPage(GdViewer1.GetRegionPage(regID))
Dim DocumentLeft As Double = GdViewer1.GetRegionLeftPixels(regID)
Dim DocumentTop As Double = GdViewer1.GetRegionTopPixels(regID)
Dim ViewerLeft As Double = 0, ViewerTop As Double = 0
GdViewer1.CoordDocumentPixelToViewerPixel(DocumentLeft, DocumentTop, ViewerLeft, ViewerTop)
Dim ViewerWidth As Double = GdViewer1.GetRegionWidthPixels(regID)
Dim ViewerHeight As Double = GdViewer1.GetRegionHeightPixels(regID)
GdViewer1.SetRectCoordinatesOnViewerPixel(ViewerLeft, ViewerTop, ViewerWidth, ViewerHeight)
Else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRectCoordinatesOnViewerPixel")
End If
Else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRectCoordinatesOnViewerPixel")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRectCoordinatesOnViewerPixel")
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)
{
//The first region surely exists.
int regID = GdViewer1.GetRegionID(1);
GdViewer1.DisplayPage(GdViewer1.GetRegionPage(regID));
double DocumentLeft = GdViewer1.GetRegionLeftPixels(regID);
double DocumentTop = GdViewer1.GetRegionTopPixels(regID);
double ViewerLeft = 0, ViewerTop = 0;
GdViewer1.CoordDocumentPixelToViewerPixel(DocumentLeft, DocumentTop, ref ViewerLeft, ref ViewerTop);
double ViewerWidth = GdViewer1.GetRegionWidthPixels(regID);
double ViewerHeight = GdViewer1.GetRegionHeightPixels(regID);
GdViewer1.SetRectCoordinatesOnViewerPixel(ViewerLeft, ViewerTop, ViewerWidth, ViewerHeight);
}
else
MessageBox.Show("The given text has not been found.", "GdViewer.SetRectCoordinatesOnViewerPixel");
}
else
MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRectCoordinatesOnViewerPixel");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRectCoordinatesOnViewerPixel");