Click or drag to resize

IMcGraphOverlayAdd Method

Create and add a new McGraphObj to the collection.

Namespace:  MediaCy.IQL.Display.Overlays
Assembly:  MediaCy.IQL.Display.Overlays (in MediaCy.IQL.Display.Overlays.dll) Version: 10.0.6912.0
Syntax
VB
Function Add ( 
	Class As String,
	Optional TemplateID As Integer = 0,
	Optional CopyTemplate As Boolean = true
) As Object

Parameters

Class
Type: SystemString
The class name for the new object (ServerName.ObjectName). Builtin classes are McGraphObjRect, McGraphObjRRect, McGraphObjEllipse, McGraphObjCircle, McGraphObjArrow, McGraphObjPoint, McGraphObjPoly ,McGraphObjText, McGraphObjBitmap and McGraphObjGroup. The ServerName part of the Class name can be omitted for builtin classes.
TemplateID (Optional)
Type: SystemInt32
The template to copy properties from (default is mcgtDefaultTemplate).
CopyTemplate (Optional)
Type: SystemBoolean
Copy template properties if True (default).

Return Value

Type: Object
A new McGraphObj instance.
Remarks
You must call the NotifyCreationComplete method before any object created or coordinate move notifications will be sent to notify clients (see example). You may specify a Template ID for the template object to be used as a pattern for the new one (assuming the CopyTemplate is passed in as the default, TRUE). If no template object of the specified Class already exists, one is automatically created. Properties of this automatically created template (and thus the displayed graphic object) are taken from the closest existing base template object with the given template ID, and if none such exists then from the default template (the one with TemplateID mcgtDefaultTemplate).
Note Note
As illustrated in the example, a call to the NotifyCreationComplete method must be made before any notifications that the object was created or moved will be sent to notify clients of the McGraphOverlay (the Overlay property). This serves two purposes: it avoids sending a bunch of expensive notifications during the process of object creation. It also allows an abort to be performed (as when the object is being created via user interaction) at any time until the NotifyCreationComplete method call is made without notify clients having to undo their object tracking.
Examples
VB
'Create and display a Filled Rectangular region
Dim myOverlay As McGraphOverlay
myOverlay = ThisApplication.ActiveImage.RegionFeatures.DisplayOverlays("DefaultOverlay")
ThisApplication.ActiveImage.RegionFeatures.DisplayOverlays.AutoDisplayTemplateID = _
mcgtStandardAutoDisplay
Dim myRect As McGraphObjRect
myRect = myOverlay.Add( "McGraphObjRect", mcgtStandardAutoDisplay)
myRect.BorderStyle = mcgfsBorderFill
myRect.SetHandle( 1, 10, 10)    ' Left,Top
myRect.SetHandle( 5, 100, 100)    ' Right,Bottom
myRect.NotifyCreationComplete    ' Notify clients that the object exists
See Also