IMcGraphOverlaySelectTool Method
|
|
Select a graphic tool used to create and manipulate graphic objects.
Namespace:
MediaCy.IQL.Display.Overlays
Assembly:
MediaCy.IQL.Display.Overlays (in MediaCy.IQL.Display.Overlays.dll) Version: 10.0.6912.0
SyntaxFunction SelectTool (
Optional ToolClassName As String = "",
Optional GraphObjClassName As String = "",
Optional TemplateID As Integer = 0
) As IMcGraphToolServer
Parameters
- ToolClassName (Optional)
- Type: SystemString
The tool class name. If this is an empty string (the
default), then the either no tool is being selected (GraphObjClassName is
also an empty string) or a built-in creation tool for some graphic object is
being selected (GraphObjClassName is the class name of the type of object
being created). If it is "McGraphToolSelect", then the built-in object
selection tool is becomes the current tool. Otherwise it must be the ProgID
of some custom tool class exposing a McGraphToolServer interface and
either the _IMcBasicViewEvents custom interface or the _IMcViewEvents
dispinterface. - GraphObjClassName (Optional)
- Type: SystemString
The class name of the graphic objects to create.
This string is ignored when ToolClassName is "McGraphToolSelect". If this
is an empty string (the default) and ToolClassName is also an empty string
then no tool is active. - TemplateID (Optional)
- Type: SystemInt32
The template used when creating new graphic objects. This
is mcgtDefaultTemplate (0) by default.
Return Value
Type:
IMcGraphToolServerA new McGraphToolServer instance for the selected tool or Nothing
if no tool is selected (both ToolClassName and GraphObjClassName are empty). See
the ActiveTool property for more discussion. The returned instance must be
released before the active McGraphOverlay can be released.
RemarksBuiltin tool classes are McGraphToolSelect, McGraphToolRect, and McGraphToolPoly.
Instances of user defined classes implementing McGraphToolServer can also be
selected using the standard ServerName.ObjectName syntax (ServerName can be omitted
builtin classes). McGraphToolPoly can only be used to create McGraphObjPoly objects,
while McGraphToolRect will be used for all other built-in objects. McGraphToolSelect
is used to select, resize or move existing objects.
Tools can also be used to create instances of user defined classes implementing
the McGraphToolServer interface: GraphObjClassName should use the standard
ServerName.ObjectName syntax (ServerName can be omitted for builtin classes).
Note |
---|
Calling SelectTool sets the value of any ancestor McImage's LastActiveTool
property. This will be the same as the return value from this method. This
instance of McGraphOverlay will not be fully released until the return value
of the SelectTool call has been released and also the McImage.LastActiveTool property
has been assigned Nothing.
For custom tools, the returned McGraphToolServer is the actual custom tool
instance, but the McGraphToolServer placed into the McImage.LastActiveTool
property is a separate McGraphToolServer instance holding a copy of the custom
tool's properties. The reason for doing this is that you will want to have
access to the actual custom tool for access to information about its current
state and also to access any extra control interfaces that it might expose. But
the McImage.LastActiveTool property must survive the shut-down of the custom
tool when some other image's overlay gets a SelectTool call. |
Examples
ThisApplication.ActiveImage.AnnotationOverlay.SelectTool "McGraphToolSelect"
ThisApplication.ActiveImage.AnnotationOverlay.SelectTool , "McGraphObjRect"
ThisApplication.ActiveImage.AnnotationOverlay.SelectTool
ThisApplication.ActiveImage.Aoi.DisplayOverlays("DefaultOverlay").SelectTool _
, "McGraphObjEllipse", mcgtStandardAutoDisplay
Sub ShowLastActiveTool()
Dim ActiveTool As McGraphToolServer
Set ActiveTool = ThisApplication.ActiveImage.LastActiveTool
If ActiveTool Is Nothing Then
MsgBox "Last SelectTool was No Tool."
Else
MsgBox "Last Active Tool Overlay: " _
& ThisApplication.McObject(ActiveTool.ActiveOverlay).Name(True) & vbCrlf _
& "Tool Name: " & ActiveTool.ToolClassName & vbCrlf _
& "Tool Object Name: " & ActiveTool.ActiveClassName & vbCrlf
End If
End Sub
See Also