GdPicture.NET.14
GdPicture14 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 AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) or AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) methods.
Example





In This Topic
EnsureRegionVisibility Method (GdViewer)
In This Topic
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 AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) or AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) methods.

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)
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        If text_found AndAlso (GdViewer1.RegionCount() > 0) Then
            'The first region surely exists.
            GdViewer1.EnsureRegionVisibility(GdViewer1.GetRegionID(1))
        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);
    if (GdViewer1.GetStat() == GdPictureStatus.OK)
    {
        if (text_found && (GdViewer1.RegionCount() > 0))
        {
            //The first region surely exists.
            GdViewer1.EnsureRegionVisibility(GdViewer1.GetRegionID(1));
        }
        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