ShapeContainer.GetNextShape 方法
依 ShapeCollection 的順序擷取下一個或上一個圖形。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Function GetNextShape ( _
shape As Shape, _
forward As Boolean _
) As Shape
public Shape GetNextShape(
Shape shape,
bool forward
)
public:
Shape^ GetNextShape(
Shape^ shape,
bool forward
)
member GetNextShape :
shape:Shape *
forward:bool -> Shape
public function GetNextShape(
shape : Shape,
forward : boolean
) : Shape
參數
shape
類型:Microsoft.VisualBasic.PowerPacks.Shape要開始搜尋的 Shape。
forward
類型:Booleantrue 表示要向前搜尋,false 表示要向後搜尋。
傳回值
類型:Microsoft.VisualBasic.PowerPacks.Shape
ShapeCollection 順序中的下一個 Shape。
備註
圖案加入至 ShapeCollection的命令取決於初始命令;您可以藉由呼叫 SetChildIndex 方法來變更命令。
範例
下列範例示範如何使用 GetNextShape 和 SelectNextShape 方法使用 TAB 鍵在表單的形狀間移動。 這個範例要求您的表單上必須有至少三個 RectangleShape 控制項。
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);
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)