This documentation is archived and is not being maintained.
Rectangle Class
Visual Studio 2008
Draws a rectangle.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The following example shows how to create a Rectangle element and set its properties by using code. For the complete sample, see WPF Shapes Gallery Sample.
'Add a Rectangle Element Dim myRect As New Rectangle() myRect.Stroke = Brushes.Black myRect.Stroke = Brushes.Black myRect.Fill = Brushes.SkyBlue myRect.HorizontalAlignment = HorizontalAlignment.Left myRect.VerticalAlignment = VerticalAlignment.Center myRect.Height = 50 myRect.Width = 50 myGrid.Children.Add(myRect)
More Code
| How to: Draw a Rectangle | This example shows how to draw a rectangle by using the Rectangle element. |
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: