RectangleShape クラス
更新 : 2007 年 11 月
正方形、四角形、角の丸い正方形、または角の丸い四角形として表示されるコントロールを表します。
名前空間 : Microsoft.VisualBasic.PowerPacks
アセンブリ : Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)
構文
'宣言
<ToolboxBitmapAttribute(GetType(RectangleShape), "Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")> _
Public Class RectangleShape _
Inherits SimpleShape
'使用
Dim instance As RectangleShape
[ToolboxBitmapAttribute(typeof(RectangleShape), "Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")]
public class RectangleShape : SimpleShape
[ToolboxBitmapAttribute(typeof(RectangleShape), L"Microsoft.VisualBasic.PowerPacks.RectangleShape.bmp")]
public ref class RectangleShape : public SimpleShape
public class RectangleShape extends SimpleShape
解説
RectangleShape コントロールを使用すると、デザイン時または実行時に、フォームまたはコンテナ上に四角形を描画できます。
フォームまたはコンテナにライン コントロールまたはシェイプ コントロールを追加すると、非表示の ShapeContainer オブジェクトが作成されます。ShapeContainer は、各コンテナ コントロール内で図形の描画サーフェイスとして機能します。各 ShapeContainer には対応する ShapeCollection があり、これによって、ShapeContainer に格納されるライン コントロールとシェイプ コントロールを反復処理できます。
実行時に RectangleShape コントロールを作成する場合は、ShapeContainer も作成し、RectangleShape の Parent プロパティを ShapeContainer に設定する必要があります。
例
ShapeContainer および RectangleShape を作成し、フォームに追加して、四角形を表示する例を次に示します。
Private Sub DrawRectangle()
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Dim rect1 As New Microsoft.VisualBasic.PowerPacks.RectangleShape
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the RectangleShape.
rect1.Parent = canvas
' Set the location and size of the rectangle.
rect1.Left = 10
rect1.Top = 10
rect1.Width = 300
rect1.Height = 100
End Sub
private void DrawRectangle()
{
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
Microsoft.VisualBasic.PowerPacks.RectangleShape rect1 =
new Microsoft.VisualBasic.PowerPacks.RectangleShape();
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the RectangleShape.
rect1.Parent = canvas;
// Set the location and size of the rectangle.
rect1.Left = 10;
rect1.Top = 10;
rect1.Width = 300;
rect1.Height = 100;
}
継承階層
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
Microsoft.VisualBasic.PowerPacks.Shape
Microsoft.VisualBasic.PowerPacks.SimpleShape
Microsoft.VisualBasic.PowerPacks.RectangleShape
スレッド セーフ
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
参照
参照
Microsoft.VisualBasic.PowerPacks 名前空間
その他の技術情報
ライン コントロールとシェイプ コントロールの概要 (Visual Studio)
方法 : LineShape コントロールを使用して線を描画する (Visual Studio)
方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)