GetRegionSelected Method (GdViewer)
In This Topic
Gets the selection status of 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.
To select a region means that the region is visibly marked on the page with the thin red border, so its selection status is set to true. You can change the selection of each highlighted region using the SetRegionSelected method.
You can also benefit from using the RegionSelectedByUser event.
Syntax
'Declaration
Public Function GetRegionSelected( _
ByVal As Integer _
) As Boolean
public bool GetRegionSelected(
int
)
public function GetRegionSelected(
: Integer
): Boolean;
public function GetRegionSelected(
: int
) : boolean;
public: bool GetRegionSelected(
int
)
public:
bool GetRegionSelected(
int
)
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
true if the specified region is selected, otherwise false. The
GetStat method can be subsequently used to determine if this method has been successful.
Example
How to find out if a region is selected.
'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.GetRegionSelected")
Else
MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionSelected")
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.GetRegionSelected");
}
else
MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionSelected");
Example
How to find out if a region is selected.
'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.GetRegionSelected")
Else
MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionSelected")
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.GetRegionSelected");
}
else
MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionSelected");
See Also
Reference
GdViewer Class
GdViewer Members
SetRegionSelected Method
RegionSelectedByUser Event
GetRegionID Method
AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) Method
AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) Method
GetStat Method
SetRegionSelected Method
RegionCount Method
GetRegionID Method
RemoveAllRegions Method
SearchText(String,Int32,Boolean) Method
AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) Method
AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) Method