ImageGear for .NET
Creating a Mark via Function Calls

Some applications won't use the ART ToolBar, or will provide the ToolBar and other options, to create marks. In that case, some functions in your application will need to create the marks directly. ART marks are created by using their constructors. For example, a rectangle mark can be created as follows: 

C#
Copy Code
ImGearRGBQuad igRGBQuad = new ImGearRGBQuad(255, 0, 0);
ImGearRectangle igRectangle = new ImGearRectangle(0, 0, 100, 100);
ImGearARTRectangle igARTRectangle = new ImGearARTRectangle(igRectangle, igRGBQuad);

Once it is created, it should be added to the ART page:

C#
Copy Code
int markID;
markID = igARTPage.AddMark(igARTRectangle, ImGearARTCoordinatesType.IMAGE_COORD);

Mark properties can be edited at any time:

C#
Copy Code
// Get the mark we just added.
igARTRectangle = (ImGearARTRectangle)igARTPage.MarkGet(markID);
igARTRectangle.Opacity = 128;

The same mark cannot be added to the same or another ART page twice; it must be cloned prior to adding it again, otherwise the ImGearException will be thrown. To control whether the mark already has parent group, please use ImGearARTMark.ParentGroup property. See the sample code below:

C#
Copy Code
if (igARTRectangle.ParentGroup != null)
{
    igARTRectangle = igARTRectangle.Clone();
}
igARTPage.AddMark(igARTRectangle, ImGearARTCoordinatesType.IMAGE_COORD);
ImGearARTPage otherPage = new ImGearARTPage();
igARTRectangle = igARTRectangle.Clone();
otherPage.AddMark(igARTRectangle, ImGearARTCoordinatesType.IMAGE_COORD);

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback