User Guide > How to Work with... > ART Mark Annotations > Create and Delete Annotations |
This section provides information about creating annotations...
and also information about how to...
End users can create a mark using the ART toolbar, or your application can create them directly by calling ART functions. This section describes how to create marks with user interaction through the ART toolbar.
When a button is selected from the toolbar, ART goes into "edit mode", where the mouse is used to place and size the mark. The sequence of events depends on whether the mark is one of the types that contains text or not:
If the mark does not contain text:
If the mark contains text:
During the creation of polymarks, such as Polyline, Polyline Ruler or Polygon, two options can be enabled (both are disabled by default):
ART Toolbar event handlers are implemented in the ART Forms open source code and can be modified at any time and in any way, but in order for them to work, your application needs to interact with the following events:
C# |
Copy Code |
---|---|
private void imGearPageView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { igARTForms.MouseDown(sender, e); } private void imGearPageView_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { igARTForms.MouseMove(sender, e); } private void imGearPageView_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { igARTForms.MouseUp(sender, e); } |
Some applications won't use the ART Toolbar, or will provide the Toolbar and other options to create marks. In that case, some methods 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); |
Delete annotations using ImGearARTPage.MarkRemove Method or RemoveMarks Method.