GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / RemoveRegionByID 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
RemoveRegionByID Method (GdViewer)
In This Topic
Removes a highlighted region 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.
Syntax
'Declaration
 
Public Function RemoveRegionByID( _
   ByVal RegionID As Integer _
) As GdPictureStatus
public GdPictureStatus RemoveRegionByID( 
   int RegionID
)
public function RemoveRegionByID( 
    RegionID: Integer
): GdPictureStatus; 
public function RemoveRegionByID( 
   RegionID : int
) : GdPictureStatus;
public: GdPictureStatus RemoveRegionByID( 
   int RegionID
) 
public:
GdPictureStatus RemoveRegionByID( 
   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 remove previously selected region using its identifier.
'We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
Dim regID As Integer = 0, regCount As Integer = GdViewer1.RegionCount()
If regCount > 0 Then
    'Expecting some regions have been marked as selected.
    Dim status As GdPictureStatus = GdPictureStatus.OK
    For j As Integer = 1 To regCount
        regID = GdViewer1.GetRegionID(j)
        If GdViewer1.GetRegionSelected(regID) Then
            status = GdViewer1.RemoveRegionByID(regID)
            If status <> GdPictureStatus.OK Then Exit For
        End If
    Next
    GdViewer1.Redraw()
    If status <> GdPictureStatus.OK Then MessageBox.Show("Removing regions has failed. Status: " + status.ToString(), "GdViewer.RemoveRegionByID")
Else
    MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.RemoveRegionByID")
End If
//We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
int regID = 0, regCount = GdViewer1.RegionCount();
if (regCount > 0)
{
    //Expecting some regions have been marked as selected.
    GdPictureStatus status = GdPictureStatus.OK;
    for (int j = 1; j <= regCount; j++)
    {
        regID = GdViewer1.GetRegionID(j);
        if (GdViewer1.GetRegionSelected(regID))
        {
            status = GdViewer1.RemoveRegionByID(regID);
            if (status != GdPictureStatus.OK)
                break;
        }
    }
    GdViewer1.Redraw();
    if (status != GdPictureStatus.OK)
        MessageBox.Show("Removing regions has failed. Status: " + status.ToString(), "GdViewer.RemoveRegionByID");
}
else
    MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.RemoveRegionByID");
See Also