Application.IsInScope-Eigenschaft (Visio)Application.IsInScope Property (Visio)

Bestimmt, ob ein Anruf an einen Ereignishandler zwischen einem EnterScope -Ereignis und ein ExitScope -Ereignis für einen Bereich ist.Determines whether a call to an event handler is between an EnterScope event and an ExitScope event for a scope. Schreibgeschützt.Read-only.

SyntaxSyntax

expression.expression. IsInScope( _nCmdID_ )

expression Eine Variable, die ein Application-Objekt darstellt.expression A variable that represents an Application object.

ParameterParameters

NameName Erforderlich/OptionalRequired/Optional DatentypData type BeschreibungDescription
nCmdIDnCmdID ErforderlichRequired LongLong Die Bereichs-ID.The scope ID.

RückgabewertReturn value

Boolescher WertBoolean

HinweiseRemarks

Konstanten, die Bereichs-IDs VisCmd vorangestellt und werden von der Visio-Typbibliothek deklariert.Constants representing scope IDs are prefixed with visCmd and are declared by the Visio type library. Sie können auch eine ID, die von der BeginUndoScope -Methode zurückgegeben.You can also use an ID returned by the BeginUndoScope method.

Sie können diese Eigenschaft in einem CellChanged -Ereignishandler verwenden, um festzustellen, ob eine zellenänderung das Ergebnis eines bestimmten Vorgangs war.You could use this property in a CellChanged event handler to determine whether a cell change was the result of a particular operation.

BeispielExample

In diesem Beispiel wird veranschaulicht, wie die IsInScope -Eigenschaft verwenden, um zu bestimmen, ob ein Anruf an eine Prozedur, die des CellChanged -Ereignisses verarbeitet, wird einer bestimmten Scope?that ist, ob der Anruf zwischen dem EnterScope und **ExitScope tritt auf **Ereignisse für diesen Bereich.This example shows how to use the IsInScope property to determine whether a call to a procedure that handles the CellChanged event is in a particular scope?that is, whether the call occurs between the EnterScope and ExitScope events for that scope.

 
Private WithEvents vsoApplication As Visio.Application 
Private lngScopeID As Long 
 
Public Sub IsInScope_Example() 
 
 Dim vsoShape As Visio.Shape 
 
 'Set the module-level application variable to 
 'trap application-level events. 
 Set vsoApplication = Application 
 
 'Begin a scope. 
 lngScopeID = Application.BeginUndoScope("Draw Shapes") 
 
 'Draw three shapes. 
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1) 
 ActivePage.DrawOval 3, 4, 4, 3 
 ActivePage.DrawLine 4, 5, 5, 4 
 
 'Change a cell (to trigger the CellChanged event). 
 vsoShape.Cells("Width").Formula = 5 
 
 'End and commit this scope. 
 Application.EndUndoScope lngScopeID, True 
 
End Sub 
 
Private Sub vsoApplication_CellChanged(ByVal Cell As IVCell) 
 
 'Check to see if this cell change is the result of something 
 'happening within the scope. 
 If vsoApplication.IsInScope(lngScopeID) Then 
 Debug.Print Cell.Name & " changed in scope "; lngScopeID 
 End If 
 
End Sub 
 
Private Sub vsoApplication_EnterScope(ByVal app As IVApplication, _ 
 ByVal nScopeID As Long, _ 
 ByVal bstrDescription As String) 
 
 If vsoApplication.CurrentScope = lngScopeID Then 
 Debug.Print "Entering my scope " & nScopeID 
 Else 
 Debug.Print "Enter Scope " & bstrDescription & "(" & nScopeID & ")" 
 End If 
 
End Sub 
 
Private Sub vsoApplication_ExitScope(ByVal app As IVApplication, _ 
 ByVal nScopeID As Long, _ 
 ByVal bstrDescription As String, _ 
 ByVal bErrOrCancelled As Boolean) 
 
 If vsoApplication.CurrentScope = lngScopeID Then 
 Debug.Print "Exiting my scope " & nScopeID 
 Else 
 Debug.Print "ExitScope " & bstrDescription & "(" & nScopeID & ")" 
 End If 
 
End Sub