次の方法で共有


SimpleShape.DisplayRectangle プロパティ

形状の表示領域を表す四角形を取得します。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
<BrowsableAttribute(False)> _
Public ReadOnly Property DisplayRectangle As Rectangle
[BrowsableAttribute(false)]
public Rectangle DisplayRectangle { get; }
[BrowsableAttribute(false)]
public:
property Rectangle DisplayRectangle {
    Rectangle get ();
}
[<BrowsableAttribute(false)>]
member DisplayRectangle : Rectangle with get
function get DisplayRectangle () : Rectangle

プロパティ値

型 : Rectangle
A Rectangle 、図形の表示領域を表します。

解説

呼び出すことができます、SetBoundsを変更するメソッド、 DisplayRectangle 1 回の操作でのプロパティです。

次の例を使用する方法を示しています。、 DisplayRectangle 2 つの図形の重複をするかどうかを判断するメソッド。 この例は、2 つある必要がありますOvalShapeという OvalShape1 OvalShape2 フォーム上のコントロールです。 最良の結果が重複しているので、コントロールを位置します。

Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Get the DisplayRectangle for each OvalShape. 
    Dim rect1 As Rectangle = OvalShape1.DisplayRectangle
    Dim rect2 As Rectangle = OvalShape2.DisplayRectangle
    ' If the DisplayRectangles intersect, move OvalShape2. 
    If rect1.IntersectsWith(rect2) Then
        OvalShape2.SetBounds(rect1.Right, rect1.Bottom, 
          rect2.Width, rect2.Height)
    End If 
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Get the DisplayRectangle for each OvalShape.
    Rectangle rect1 = ovalShape1.DisplayRectangle;
    Rectangle rect2 = ovalShape2.DisplayRectangle;
    // If the DisplayRectangles intersect, move OvalShape2. 
    if (rect1.IntersectsWith(rect2))
    {
        ovalShape2.SetBounds(rect1.Right, rect1.Bottom, rect2.Width, rect2.Height);
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

SimpleShape クラス

Microsoft.VisualBasic.PowerPacks 名前空間

その他の技術情報

ライン コントロールとシェイプ コントロールの概要 (Visual Studio)

方法 : LineShape コントロールを使用して線を描画する (Visual Studio)

方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)