Compartir a través de


ShapeContainer.SelectNextShape (Método)

Selecciona la forma siguiente o anterior en el orden de ShapeCollection.

Espacio de nombres:  Microsoft.VisualBasic.PowerPacks
Ensamblado:  Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxis

'Declaración
Public Function SelectNextShape ( _
    shape As Shape, _
    forward As Boolean, _
    wrap As Boolean _
) As Boolean
public bool SelectNextShape(
    Shape shape,
    bool forward,
    bool wrap
)
public:
bool SelectNextShape(
    Shape^ shape, 
    bool forward, 
    bool wrap
)
member SelectNextShape : 
        shape:Shape * 
        forward:bool * 
        wrap:bool -> bool
public function SelectNextShape(
    shape : Shape, 
    forward : boolean, 
    wrap : boolean
) : boolean

Parámetros

  • forward
    Tipo: Boolean

    true para avanzar en el orden; false para retroceder.

  • wrap
    Tipo: Boolean

    Es true para continuar la búsqueda a partir de la primer forma en el orden después de haber llegado hasta la última forma; en caso contrario, es false.

Valor devuelto

Tipo: Boolean
true si una forma está habilitada; si no, false.

Comentarios

El orden inicial es determinado por el orden en que las formas se agregan a ShapeCollection; puede cambiar el orden llamando al método SetChildIndex .

Ejemplos

El siguiente ejemplo se muestra cómo utilizar el GetNextShape y los métodos de SelectNextShape para utilizar la tecla TAB para desplazarse por las formas en un formulario. Este ejemplo requiere que tenga al menos tres controles de RectangleShape en un formulario.

Private Sub Shapes_PreviewKeyDown(
    ByVal sender As Object, 
    ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs
  ) Handles RectangleShape1.PreviewKeyDown, 
            RectangleShape2.PreviewKeyDown, 
            RectangleShape3.PreviewKeyDown

    Dim sh As Shape
    ' Check for the TAB key. 
    If e.KeyCode = Keys.Tab Then 
        ' Find the next shape in the order.
        sh = ShapeContainer1.GetNextShape(sender, True)
        ' Select the next shape.
        ShapeContainer1.SelectNextShape(sender, True, True)
    End If 
End Sub
private void Shapes_PreviewKeyDown(object sender, 
    System.Windows.Forms.PreviewKeyDownEventArgs e)
{
    Shape sh;
    // Check for the TAB key. 
    if (e.KeyCode==Keys.Tab)
        // Find the next shape in the order.
    {
        sh = shapeContainer1.GetNextShape((Shape) sender, true);
        // Select the next shape.
        shapeContainer1.SelectNextShape((Shape) sender, true, true);
    }
}

Seguridad de .NET Framework

Vea también

Referencia

ShapeContainer Clase

Microsoft.VisualBasic.PowerPacks (Espacio de nombres)

Otros recursos

Introducción a los controles de líneas y formas (Visual Studio)

Cómo: Dibujar líneas con el control LineShape (Visual Studio)

Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)