SimpleShape.SetBounds 方法
將圖案的範圍設定為指定的位置和大小。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Sub SetBounds ( _
left As Integer, _
top As Integer, _
width As Integer, _
height As Integer _
)
public void SetBounds(
int left,
int top,
int width,
int height
)
public:
void SetBounds(
int left,
int top,
int width,
int height
)
member SetBounds :
left:int *
top:int *
width:int *
height:int -> unit
public function SetBounds(
left : int,
top : int,
width : int,
height : int
)
參數
- left
型別:System.Int32
- top
型別:System.Int32
- width
型別:System.Int32
圖案的新寬度屬性值。
- height
型別:System.Int32
圖案的新高度屬性值。
備註
您可以使用SetBounds方法,以變更圖形的大小和位置,在單一陳述式。
範例
下列範例會示範如何使用SetBounds方法來變更圖形的位置和大小。具體來說,圖形會移到表單的左上角與變更為正方形。這個範例要求您必須RectangleShape控制項的表單上命名為 RectangleShape1。
Private Sub RectangleShape1_Click() Handles RectangleShape1.Click
' Change the Bounds property.
RectangleShape1.SetBounds(0, 0, 100, 100)
End Sub
private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
// Change the Bounds property.
rectangleShape1.SetBounds(0, 0, 100, 100);
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)