GdPicture.NET Reference Guide
EnsureRegionVisibility Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : EnsureRegionVisibility Method
A unique region identifier of the specified region. You can obtain this identifier using the GetRegionID method or when creating regions using the AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) method.
Ensures the visibility of a highlighted region within the current GdViewer control. The region is specified by its unique identifier related to the document currently displayed in the GdViewer control. These regions, if present, determines the currently defined highlighted regions on the displayed document.

To confirm the region visibility means that the control can change the current page or can scroll the content to ensure that the required region is fully visible.

Syntax
'Declaration
 
Public Function EnsureRegionVisibility( _
   ByVal RegionID As Integer _
) As GdPictureStatus
public GdPictureStatus EnsureRegionVisibility( 
   int RegionID
)
public function EnsureRegionVisibility( 
    RegionID: Integer
): GdPictureStatus; 
public function EnsureRegionVisibility( 
   RegionID : int
) : GdPictureStatus;
public: GdPictureStatus EnsureRegionVisibility( 
   int RegionID
) 
public:
GdPictureStatus EnsureRegionVisibility( 
   int RegionID
) 

Parameters

RegionID
A unique region identifier of the specified region. You can obtain this identifier using the GetRegionID method or when creating regions using the AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) method.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
Be aware that if the required region does not exist, the method will fail.
Example
How to ensure that the first region is visible after the successful search.
'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, True)
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        If text_found AndAlso (GdViewer1.RegionCount() > 0) Then
            'The first region surely exists.
            GdViewer1.EnsureRegionVisibility(GdViewer1.GetRegionID(0))
        Else
            MessageBox.Show("The given text has not been found.", "GdViewer.EnsureRegionVisibility")
        End If
    Else
        MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.EnsureRegionVisibility")
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.EnsureRegionVisibility")
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, true);
    if (GdViewer1.GetStat() == GdPictureStatus.OK)
    {
        if (text_found && (GdViewer1.RegionCount() > 0))
        {
            //The first region surely exists.
            GdViewer1.EnsureRegionVisibility(GdViewer1.GetRegionID(0));
        }
        else
            MessageBox.Show("The given text has not been found.", "GdViewer.EnsureRegionVisibility");
    }
    else
        MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.EnsureRegionVisibility");
}
else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.EnsureRegionVisibility");
See Also

Reference

GdViewer Class
GdViewer Members
RegionCount Method
GetRegionID Method
SearchText(String,Int32,Boolean) Method
SearchText(String,Int32,Boolean,Boolean) Method
AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) Method
RemoveAllRegions Method