GdPicture.NET Reference Guide
IsRect Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : IsRect Method
Detects, if the rectangle of area selection is drawn within the GdViewer control, which means this rectangle is defined. Please note that the rectangle of selection always relates to the document currently displayed in the GdViewer control.

You can define the custom rectangle of selection using one of these methods: SetRectCoordinatesOnDocumentPixel , SetRectCoordinatesOnDocumentInch and SetRectCoordinatesOnViewerPixel.

You can use the CenterOnRect method to make the rectangle visible, if any is defined, or the ClearRect method to clear the rectangle's location point and dimensions.

Syntax
'Declaration
 
Public Function IsRect() As Boolean
public bool IsRect()
public function IsRect(): Boolean; 
public function IsRect() : boolean;
public: bool IsRect(); 
public:
bool IsRect(); 

Return Value

True/true if the rectangle of area selection is currently drawn, means defined, in the control, else False/false.
Remarks
Be aware that you are allowed to define only one rectangle of selection within the GdViewer control. Likewise, this rectangle always relates to the currently displayed document, meaning that without displaying some document you cannot specify the new rectangle of selection.
Example
How to clear the previously specified rectangle of selection and define the new one.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
If GdViewer1.SelectAllText() = GdPictureStatus.OK Then
    If GdViewer1.IsRect() Then GdViewer1.ClearRect()
    Dim regions As Rect() = GdViewer1.GetSelectedTextRegions()
    If (GdViewer1.GetStat() = GdPictureStatus.OK) AndAlso (regions.Length > 0) Then
        Dim rect As Rect = regions(0)
        GdViewer1.SetRectCoordinatesOnDocumentInch(rect.Left, rect.Top, rect.Width, rect.Height)
        GdViewer1.CenterOnRect()
    Else
        MessageBox.Show("The text region can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IsRect")
    End If
Else
    MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IsRect")
End If
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
if (GdViewer1.SelectAllText() == GdPictureStatus.OK)
{
    if (GdViewer1.IsRect()) GdViewer1.ClearRect();
    Rect[] regions = GdViewer1.GetSelectedTextRegions();
    if ((GdViewer1.GetStat() == GdPictureStatus.OK) && (regions.Length > 0))
    {
        //The first region surely exists.
        Rect rect = regions[0];
        GdViewer1.SetRectCoordinatesOnDocumentInch(rect.Left, rect.Top, rect.Width, rect.Height);
        GdViewer1.CenterOnRect();
    }
    else
        MessageBox.Show("The text region can't be found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IsRect");
}
else
    MessageBox.Show("The text can't be selected. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.IsRect");
See Also

Reference

GdViewer Class
GdViewer Members
ClearRect Method
CenterOnRect Method
RectBorderColor Property
RectBorderSize Property
SelectAllText Method
SetRectCoordinatesOnDocumentPixel Method
SetRectCoordinatesOnDocumentInch Method
SetRectCoordinatesOnViewerPixel Method