Costruttore RectangleShape (Int32, Int32, Int32, Int32)
Inizializza una nuova istanza di RectangleShape classe, specificando la posizione e le dimensioni.
Spazio dei nomi: Microsoft.VisualBasic.PowerPacks
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintassi
'Dichiarazione
Public Sub New ( _
left As Integer, _
top As Integer, _
width As Integer, _
height As Integer _
)
public RectangleShape(
int left,
int top,
int width,
int height
)
public:
RectangleShape(
int left,
int top,
int width,
int height
)
new :
left:int *
top:int *
width:int *
height:int -> RectangleShape
public function RectangleShape(
left : int,
top : int,
width : int,
height : int
)
Parametri
- left
Tipo: System.Int32
- top
Tipo: System.Int32
- width
Tipo: System.Int32
Integer rappresentazione della larghezza (in pixel) di RectangleShape.
- height
Tipo: System.Int32
Integer rappresentazione dell'altezza (in pixel) di RectangleShape.
Note
In RectangleShape il controllo non può essere visualizzata direttamente su un form o un controllo contenitore, deve essere contenuto in un oggetto ShapeContainer oggetto.Dopo avere inizializzato un oggetto RectangleShape, sarà necessario impostarne Parent proprietà o a un oggetto esistente ShapeContainer o a una nuova istanza di ShapeContainer.
Esempi
Nell'esempio seguente viene creato un oggetto ShapeContainer e RectangleShape, li aggiunge a un form e visualizzare un 90 pixel da un quadrato di 90 pixel.
Private Sub DrawSquare()
Dim canvas As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
' Declare a RectangleShape and set the location and size.
Dim rect1 As New Microsoft.VisualBasic.PowerPacks.
RectangleShape(15, 15, 105, 105)
' Set the form as the parent of the ShapeContainer.
canvas.Parent = Me
' Set the ShapeContainer as the parent of the RectangleShape.
rect1.Parent = canvas
End Sub
private void DrawSquare()
{
Microsoft.VisualBasic.PowerPacks.ShapeContainer canvas =
new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
// Declare a RectangleShape and set the location and size.
Microsoft.VisualBasic.PowerPacks.RectangleShape rect1 =
new Microsoft.VisualBasic.PowerPacks.RectangleShape(15, 15, 105, 105);
// Set the form as the parent of the ShapeContainer.
canvas.Parent = this;
// Set the ShapeContainer as the parent of the RectangleShape.
rect1.Parent = canvas;
}
Sicurezza di .NET Framework
- Attendibilità totale per il chiamante immediato. Impossibile utilizzare questo membro in codice parzialmente attendibile. Per ulteriori informazioni, vedere Utilizzo di librerie da codice parzialmente attendibile.
Vedere anche
Riferimenti
Spazio dei nomi Microsoft.VisualBasic.PowerPacks
Altre risorse
Introduzione ai controlli Line e Shape (Visual Studio)
Procedura: disegnare linee con il controllo LineShape (Visual Studio)
Procedura: disegnare forme con i controlli OvalShape e RectangleShape (Visual Studio)