'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
Dim left As Double = 0, top As Double = 0, width As Double = 0, height As Double = 0
GdViewer1.GetDisplayedArea(left, top, width, height)
Dim imageID As Integer = GdViewer1.CopyRegionToGdPictureImage(CInt(left), CInt(top), CInt(width), CInt(height))
If GdViewer1.GetStat() = GdPictureStatus.OK Then
Using oImage As GdPictureImaging = New GdPictureImaging()
If oImage.SaveAsJPEG(imageID, "visible_region.jpg") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "GdViewer.CopyRegionToGdPictureImage")
Else
MessageBox.Show("The image can't be saved. Status: " + oImage.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage")
End If
End Using
GdViewer1.ReleaseGdPictureImage(imageID)
Else
MessageBox.Show("The image can't be created. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage")
End If
Else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
double left = 0, top = 0, width = 0, height = 0;
GdViewer1.GetDisplayedArea(ref left, ref top, ref width, ref height);
int imageID = GdViewer1.CopyRegionToGdPictureImage((int)left, (int)top, (int)width, (int)height);
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
using (GdPictureImaging oImage = new GdPictureImaging())
{
if (oImage.SaveAsJPEG(imageID, "visible_region.jpg") == GdPictureStatus.OK)
MessageBox.Show("Done!", "GdViewer.CopyRegionToGdPictureImage");
else
MessageBox.Show("The image can't be saved. Status: " + oImage.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage");
}
GdViewer1.ReleaseGdPictureImage(imageID);
}
else MessageBox.Show("The image can't be created. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage");
}
else
MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.CopyRegionToGdPictureImage");