Compartir a través de


Método Window.Select (Visio)

Selecciona o anula la selección de un objeto.

Sintaxis

expresión. Seleccionar (SheetObject, SelectAction)

Expresión Variable que representa un objeto Window .

Parameters

Nombre Obligatorio/opcional Tipo de datos Descripción
SheetObject Obligatorio [IVSHAPE] Expresión que devuelve el objeto Shape que se debe seleccionar o cuya selección se debe anular.
SelectAction Obligatorio Integer Tipo de acción de selección que se va a realizar.

Valor devuelto

Nothing

Comentarios

Cuando se usa con el objeto Window, el método Select afecta a la selección de la ventana de Microsoft Visio. Sin embargo, el objeto Selection es independiente de la selección realizada en la ventana. Por lo tanto, el uso del método Select con un objeto Selection solo afecta al estado del objeto en la memoria; la ventana de Visio no se verá afectada.

Las siguientes constantes declaradas en la biblioteca de tipos de Visio en VisSelectArgs muestran valores válidos para los tipos de selección.

Constante Valor Descripción
visDeselect 1 Se cancela la selección de una forma, pero no afecta al resto de la selección.
visSelect 2 Se selecciona una forma, pero no afecta al resto de la selección.
visSubSelect 3 Se selecciona una forma cuya forma principal ya se encuentra seleccionada.
visSelectAll 4 Selecciona una forma y todas las de su mismo nivel.
visDeselectAll 256 Se cancela la selección de una forma y de todas las de su mismo nivel.

Si SelectAction es visSubSelect, la forma principal de SheetObject ya debe estar seleccionada.

Puede combinar visDeselectAll con visSelect y visSubSelect para anular la selección de todas las formas antes de seleccionar o subseleccionar otras formas.

Si el objeto sobre el que se está operando es un objeto Selection, y si el método Select selecciona un objeto Shape cuya propiedad ContainingShape es distinta de la propiedad ContainingShape del objeto Selection, el método Select anula la selección de todos los elementos, aun cuando el valor del tipo de selección no lo especifique así.

Si el objeto sobre el que se está operando es un objeto Window, y si SelectAction no es visSubSelect, la forma principal de SheetObject debe ser la misma forma que la devuelta por la propiedad ContainingShape del objeto Window.Selection.

Si la solución de Visual Studio incluye la referencia Microsoft.Office.Interop.Visio , este método se asigna a los tipos siguientes:

  • Microsoft.Office.Interop.Visio.IVWindow.Select(Microsoft.Office.Interop.Visio.Shape, short)

Ejemplo:

Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo seleccionar, anular la selección y subseleccionar formas.

 
Public Sub Select_Example()  
 
    Const MAX_SHAPES = 6  
    Dim vsoShapes(1 To MAX_SHAPES) As Visio.Shape  
    Dim intCounter As Integer  
 
    'Draw six rectangles.  
    For intCounter = 1 To MAX_SHAPES  
        Set vsoShapes(intCounter) = ActivePage.DrawRectangle(intCounter, intCounter + 1, intCounter + 1, intCounter)  
    Next intCounter  
 
    'Cancel the selection of all the shapes on the page.  
    ActiveWindow.DeselectAll  
 
     'Create a Selection object. 
    Dim vsoSelection As Visio.Selection  
    Set vsoSelection = ActiveWindow.Selection  
 
    'Select the first three shapes on the page. 
    For intCounter = 1 To 3  
        vsoSelection.Select vsoShapes(intCounter), visSelect  
    Next intCounter  
 
    'Group the selected shapes.  
    'Although the first three shapes are now grouped, the  
    'array vsoShapes() still contains them. 
    Dim vsoGroup As Visio.Shape  
    Set vsoGroup = vsoSelection.Group 
 
    'There are now four shapes on the page: a group that contains three  
    'subshapes, and three ungrouped shapes. Subselection is  
    'accomplished by selecting the parent shape first or one of the  
    'group's shapes already subselected.  
 
    'Select parent (group) shape. 
    ActiveWindow.Select vsoGroup, visDeselectAll + visSelect  
 
    'Subselect two of the shapes in the group. 
    ActiveWindow.Select vsoShapes(1), visSubSelect  
    ActiveWindow.Select vsoShapes(3), visSubSelect  
 
     'At this point two shapes are subselected, but we want to  
    'start a new selection that includes the last two shapes  
    'added to the page and the group. 
 
    'Note that the subselections that were made in the group  
    'are canceled by selecting another shape that is 
    'at the same level as the parent of the subselected shapes.  
 
    'Select just one shape. 
     ActiveWindow.Select vsoShapes(MAX_SHAPES), _  
        visDeselectAll + visSelect  
 
    'Select another shape. 
    ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visSelect  
 
    'Select the group.  
    ActiveWindow.Select vsoGroup, visSelect  
 
    'Select all but one shape on the page.  
    ActiveWindow.SelectAll  
    ActiveWindow.Select vsoShapes(MAX_SHAPES - 1), visDeselect  
 
End Sub

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.