RemoveRegionByName Method (GdViewer)
In This Topic
Removes a highlighted region specified by its name 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
Parameters
- Name
- The name of the required region, which you have added using the AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) method or which you have identified using the SetRegionName 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.
Example
How to remove one or more regions using its name.
'We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
'Here we make use of the RegionSelected event.
Sub GdViewer1_RegionSelected(ByVal sender As Object, ByVal e As GdPicture14.WPF.GdViewer.RegionSelectedEventArgs)
GdViewer1.SetRegionName(GdViewer1.GetRegionID(e.RegionID), "ToRemove")
End Sub
Sub GdViewer1_RemoveRegions()
If GdViewer1.RegionCount() > 0 Then
'Expecting some regions have been marked for removing using the RegionSelected event.
Dim status As GdPictureStatus = GdViewer1.RemoveRegionByName("ToRemove")
GdViewer1.Redraw()
If status <> GdPictureStatus.OK Then MessageBox.Show("Removing regions has failed. Status: " & status.ToString(), "GdViewer.RemoveRegionByName")
Else
MessageBox.Show("No highlighted region found related to this document. Status: " & GdViewer1.GetStat().ToString(), "GdViewer.RemoveRegionByName")
End If
End Sub
//We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
//Here we make use of the RegionSelected event.
void GdViewer1_RegionSelected(object sender, GdPicture14.WPF.GdViewer.RegionSelectedEventArgs e)
{
GdViewer1.SetRegionName(GdViewer1.GetRegionID(e.RegionID), "ToRemove");
}
void GdViewer1_RemoveRegions()
{
if (GdViewer1.RegionCount() > 0)
{
//Expecting some regions have been marked for removing using the RegionSelected event.
GdPictureStatus status = GdViewer1.RemoveRegionByName("ToRemove");
GdViewer1.Redraw();
if (status != GdPictureStatus.OK)
MessageBox.Show("Removing regions has failed. Status: " + status.ToString(), "GdViewer.RemoveRegionByName");
}
else
MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.RemoveRegionByName");
}
See Also
Reference
GdViewer Class
GdViewer Members
RegionSelected Event
RemoveRegionByID Method
RegionCount Method
GetRegionID Method
SearchText(String,Int32,Boolean) Method
SearchText(String,Int32,Boolean,Boolean) Method
SearchText(Int32,String,Int32,Boolean,Double,Double,Double,Double) Method
SearchText(Int32,String,Int32,Boolean,Boolean,Double,Double,Double,Double) Method
AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) Method