SimpleShape.ClientRectangle 屬性
取得代表圖形工作區的矩形。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
<BrowsableAttribute(False)> _
Public ReadOnly Property ClientRectangle As Rectangle
[BrowsableAttribute(false)]
public Rectangle ClientRectangle { get; }
[BrowsableAttribute(false)]
public:
property Rectangle ClientRectangle {
Rectangle get ();
}
[<BrowsableAttribute(false)>]
member ClientRectangle : Rectangle with get
function get ClientRectangle () : Rectangle
屬性值
類型:Rectangle
ARectangle相對於父控制項,以像素表示的大小和形狀的位置。
備註
您可以呼叫SetBounds方法,以變更ClientRectangle單一作業中的屬性。
因為SimpleShape有沒有非用戶端區域,Bounds和ClientRectangle屬性都相同。
範例
下列範例示範如何使用DrawToBitmap方法和ClientRectangle屬性來繪製OvalShape最上層的PictureBox控制項。
Private Sub Form1_Load() Handles MyBase.Load
Dim pic As New System.Drawing.Bitmap(Me.PictureBox1.Image,
PictureBox1.Width, PictureBox1.Height)
Dim rect As New System.Drawing.Rectangle
' Assign the client rectangle.
rect = OvalShape1.ClientRectangle
' Draw the oval on the bitmap.
OvalShape1.DrawToBitmap(pic, rect)
PictureBox2.Image = pic
End Sub
private void form1_Load(System.Object sender, System.EventArgs e)
{
System.Drawing.Bitmap pic = new System.Drawing.Bitmap(this.pictureBox1.Image,
pictureBox1.Width, pictureBox1.Height);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle();
// Assign the client rectangle.
rect = ovalShape1.ClientRectangle;
// Draw the oval on the bitmap.
ovalShape1.DrawToBitmap(pic, rect);
pictureBox2.Image = pic;
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)