GdPicture.NET Reference Guide
GetRegionColorSelection Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : GetRegionColorSelection 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.
Gets the fill color of a highlighted region, when it is selected by the user. 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.

You can define this color of each highlighted region using the SetRegionColorSelection method.

Syntax
'Declaration
 
Public Function GetRegionColorSelection( _
   ByVal RegionID As Integer _
) As Color
public Color GetRegionColorSelection( 
   int RegionID
)
public function GetRegionColorSelection( 
    RegionID: Integer
): Color; 
public function GetRegionColorSelection( 
   RegionID : int
) : Color;
public: Color GetRegionColorSelection( 
   int RegionID
) 
public:
Color GetRegionColorSelection( 
   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 the AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) method.

Return Value

The fill color of the specified region when it is selected by the user. Please always use the GetStat method to determine if this method has been successful.
Remarks
Be aware that if the required region does not exist, the method will fail.

Just to inform you, that the default fill color set by the toolkit is aquamarine, ARGB(127, 255, 212).

Example
How to find out some region properties.
'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
        If text_found Then
            'Taking the first region to determine default values for some region properties set by the toolkit.
            Dim regID As Integer = GdViewer1.GetRegionID(0)
            If GdViewer1.GetStat() = GdPictureStatus.OK Then
                Dim message As String = "The number of highlighted regions: " + GdViewer1.RegionCount().ToString()
                message = message + vbCrLf + "name: " + GdViewer1.GetRegionName(regID).ToString()
                message = message + "  color: " + GdViewer1.GetRegionColor(regID).ToString()
                message = message + vbCrLf + "border width: " + GdViewer1.GetRegionBorderWidth(regID).ToString()
                message = message + "  border color: " + GdViewer1.GetRegionBorderColor(regID).ToString()
                message = message + "  color selection: " + GdViewer1.GetRegionColorSelection(regID).ToString()
                MessageBox.Show(message, "GdViewer.GetRegionColor")
            Else
                MessageBox.Show("The regionID has not been found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection")
            End If
        Else
            MessageBox.Show("The given text has not been found.", "GdViewer.GetRegionColorSelection")
        End If
    Else
        MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection")
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection")
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)
    {
        if (text_found)
        {
            //Taking the first region to determine default values for some region properties set by the toolkit.
            int regID = GdViewer1.GetRegionID(0);
            if (GdViewer1.GetStat() == GdPictureStatus.OK)
            {
                string message = "The number of highlighted regions: " + GdViewer1.RegionCount().ToString();
                message = message + "\nname: " + GdViewer1.GetRegionName(regID).ToString();
                message = message + "  color: " + GdViewer1.GetRegionColor(regID).ToString();
                message = message + "\nborder width: " + GdViewer1.GetRegionBorderWidth(regID).ToString();
                message = message + "  border color: " + GdViewer1.GetRegionBorderColor(regID).ToString();
                message = message + "  color selection: " + GdViewer1.GetRegionColorSelection(regID).ToString();
                MessageBox.Show(message, "GdViewer.GetRegionColor");
            }
            else
            {
                MessageBox.Show("The regionID has not been found. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection");
            }
        }
        else
            MessageBox.Show("The given text has not been found.", "GdViewer.GetRegionColorSelection");
    }
    else
        MessageBox.Show("The search process has failed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection");
}
else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetRegionColorSelection");
See Also

Reference

GdViewer Class
GdViewer Members
SetRegionColorSelection Method
RegionCount Method
GetRegionID Method
SearchText(String,Int32,Boolean) Method
SearchText(String,Int32,Boolean,Boolean) Method
AddRegion(String,Double,Double,Double,Double,Color,RegionFillMode) Method
GetRegionColor Method
SetRegionColor Method