Reference Guide
GdPicture14.WPF Namespace / GdViewer Class / SetRegionHeight 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.
The new height, in inches, of the highlighted region's rectangle, related to the actual document.
Example





In This Topic
    SetRegionHeight Method (GdViewer)
    In This Topic
    Sets the height of the highlighted region's rectangle, in inches, related to the actual document (meaning the document pages area). The highlighted 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.

    You can define the height of the region's rectangle when adding regions using the AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) method. You can determine the height of the region's rectangle using the GetRegionHeight method.

    Syntax
    'Declaration
     
    
    Public Function SetRegionHeight( _
       ByVal RegionID As Integer, _
       ByVal Height As Double _
    ) As GdPictureStatus
    public GdPictureStatus SetRegionHeight( 
       int RegionID,
       double Height
    )
    public function SetRegionHeight( 
        RegionID: Integer;
        Height: Double
    ): GdPictureStatus; 
    public function SetRegionHeight( 
       RegionID : int,
       Height : double
    ) : GdPictureStatus;
    public: GdPictureStatus SetRegionHeight( 
       int RegionID,
       double Height
    ) 
    public:
    GdPictureStatus SetRegionHeight( 
       int RegionID,
       double Height
    ) 

    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.
    Height
    The new height, in inches, of the highlighted region's rectangle, related to the actual document.

    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.

    Please note that the returned value corresponds to the actual document area, it is not related to the GdViewer control area.

    Example
    How to enlarge all defined highlighted regions by setting their new positions and new sizes.
    '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
            Dim regCount As Integer = GdViewer1.RegionCount(), regID As Integer = 0
            If text_found AndAlso (regCount > 0) Then
                For j As Integer = 0 To regCount-1
                    regID = GdViewer1.GetRegionID(j)
                    GdViewer1.SetRegionLeft(regID, GdViewer1.GetRegionLeft(regID) - 0.15F)
                    GdViewer1.SetRegionTop(regID, GdViewer1.GetRegionTop(regID) - 0.15F)
                    GdViewer1.SetRegionWidth(regID, GdViewer1.GetRegionWidth(regID) + 0.3F)
                    GdViewer1.SetRegionHeight(regID, GdViewer1.GetRegionHeight(regID) + 0.3F)
                Next
                GdViewer1.Redraw()
            Else
                MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionHeight")
            End If
        Else
            MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionHeight")
        End If
    Else
        MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionHeight")
    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)
        {
            int regCount = GdViewer1.RegionCount(), regID = 0;
            if (text_found && (regCount > 0))
            {
                for (int j = 0; j < regCount; j++)
                {
                    regID = GdViewer1.GetRegionID(j);
                    GdViewer1.SetRegionLeft(regID, GdViewer1.GetRegionLeft(regID) - 0.15f);
                    GdViewer1.SetRegionTop(regID, GdViewer1.GetRegionTop(regID) - 0.15f);
                    GdViewer1.SetRegionWidth(regID, GdViewer1.GetRegionWidth(regID) + 0.3f);
                    GdViewer1.SetRegionHeight(regID, GdViewer1.GetRegionHeight(regID) + 0.3f);
                }
                GdViewer1.Redraw();
            }
            else
                MessageBox.Show("The given text has not been found.", "GdViewer.SetRegionHeight");
        }
        else
            MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionHeight");
    }
    else
        MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionHeight");
    See Also