GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / SetRegionMixMode 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.
A member of the ForegroundMixMode enumeration. The new value of the foreground mix mode to be used.
Example





In This Topic
SetRegionMixMode Method (GdViewer)
In This Topic
Sets the foreground mix mode 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.

The foreground mix mode is used to combine the region fill color and the displayed area of the image covered by this region when highlighting. You can define this parameter of each highlighted region when adding regions using AddRegion(String,Int32,Int32,Int32,Int32,ForegroundMixMode,Int32) or AddRegionInches(String,Single,Single,Single,Single,ForegroundMixMode,Int32) methods. You can determine this parameter of each highlighted region using the GetRegionMixMode method.

Syntax
'Declaration
 
Public Function SetRegionMixMode( _
   ByVal RegionID As Integer, _
   ByVal MixMode As ForegroundMixMode _
) As GdPictureStatus
public GdPictureStatus SetRegionMixMode( 
   int RegionID,
   ForegroundMixMode MixMode
)
public function SetRegionMixMode( 
    RegionID: Integer;
    MixMode: ForegroundMixMode
): GdPictureStatus; 
public function SetRegionMixMode( 
   RegionID : int,
   MixMode : ForegroundMixMode
) : GdPictureStatus;
public: GdPictureStatus SetRegionMixMode( 
   int RegionID,
   ForegroundMixMode MixMode
) 
public:
GdPictureStatus SetRegionMixMode( 
   int RegionID,
   ForegroundMixMode MixMode
) 

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.
MixMode
A member of the ForegroundMixMode enumeration. The new value of the foreground mix mode to be used.

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 reset the foreground mix mode parameter of a highlighted region.
'We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
            
'To successfully follow this example, please use the code snippet attached to AddRegion or AddRegionInches methods
'to define highlighted regions or define some highlighted regions using SearchText methods by yourself.
Dim regID As Integer = 0, regCount As Integer = GdViewer1.RegionCount()
            
If regCount > 0 Then
    Dim firstMode As ForegroundMixMode = GdViewer1.GetRegionMixMode(GdViewer1.GetRegionID(1))
    Dim currMode As ForegroundMixMode = ForegroundMixMode.ForegroundMixModeUNDEFINED
    Dim newMode As ForegroundMixMode = ForegroundMixMode.ForegroundMixModeBLACK
    For j As Integer = 1 To regCount
        regID = GdViewer1.GetRegionID(j)
        currMode = GdViewer1.GetRegionMixMode(regID)
        If currMode = firstMode Then GdViewer1.SetRegionMixMode(regID, newMode)
    Next
    'Redrawing regions with the newly defined mix mode parameter.
    GdViewer1.Redraw()
Else
    MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionMixMode")
End If
//We assume that the GdViewer1 control has been properly integrated and your document has been properly displayed as well.
            
//To successfully follow this example, please use the code snippet attached to AddRegion or AddRegionInches methods
//to define highlighted regions or define some highlighted regions using SearchText methods by yourself.
int regID = 0, regCount = GdViewer1.RegionCount();
if (regCount > 0)
{
    ForegroundMixMode firstMode = GdViewer1.GetRegionMixMode(GdViewer1.GetRegionID(1));
    ForegroundMixMode currMode = ForegroundMixMode.ForegroundMixModeUNDEFINED;
    ForegroundMixMode newMode = ForegroundMixMode.ForegroundMixModeBLACK;
    for (int j = 1; j <= regCount; j++)
    {
        regID = GdViewer1.GetRegionID(j);
        currMode = GdViewer1.GetRegionMixMode(regID);
        if (currMode == firstMode)
            GdViewer1.SetRegionMixMode(regID, newMode);
    }
    //Redrawing regions with the newly defined mix mode parameter.
    GdViewer1.Redraw();
}
else
    MessageBox.Show("No highlighted region found related to this document. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetRegionMixMode");
See Also