Class
RoundRectShape
Description
Draws a (two-dimensional) rounded rectangle in a vector graphics environment.
Properties
Name |
Type |
Read-Only |
Shared |
---|---|---|---|
Property descriptions
RoundRectShape.BorderColor
BorderColor As Color
The color of the object's border.
RoundRectShape.BorderOpacity
BorderOpacity As Double
Indicates the level of opacity.
Degrees of transparency is currently supported only on macOS and Windows. On other platforms, the border is either visible (100%) or invisible.
The following code adds a border to an ArcShape:
Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.FillColor = Color.Red
g.DrawObject(a)
RoundRectShape.BorderWidth
BorderWidth As Double
The width of the border, in points. The default is 1.
The width a Double value with a default of 1.0.
RoundRectShape.CornerHeight
CornerHeight As Double
The height of the inset corner oval.
RoundRectShape.CornerWidth
CornerWidth As Double
The width of the inset corner oval.
RoundRectShape.FillColor
FillColor As Color
The color of the interior of the shape.
RoundRectShape.FillOpacity
FillOpacity As Double
The opacity of the interior, from 0 (completely transparent) to 100 (opaque).
This example sets the Fill to 50% opacity.
Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.BorderColor = Color.Black
a.BorderWidth = 2.75
a.FillOpacity = 50
a.FillColor = Color.Red
g.DrawObject(a)
RoundRectShape.Height
Height As Double
The height of the rectangle.
This example sets the height and width of the shape to 150 pixels.
Var r As New RectShape
r.Width = 150
r.Height = 150
r.Border = 100
r.BorderColor = Color.Black
r.FillColor = Color.Teal
r.BorderWidth = 2.5
r.Rotation = -0.78
g.DrawObject(r)
RoundRectShape.Rotation
Rotation As Double
Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.
This code rotates the arc 0.9 radians.
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.Rotation = 0.90
a.ArcAngle = 1.57
a.StartAngle = -1.57
g.DrawObject(a)
RoundRectShape.Scale
Scale As Double
The scaling factor relative to the object's original size.
The following code rescales the arc by a factor of 1.5.
Var a As New ArcShape
a.Scale = 1.5
a.Rotation = .90
a.ArcAngle = 1.57
a.StartAngle = -1.57
g.DrawObject(a)
RoundRectShape.Segments
Segments As Integer
The number of polygon sides to use when approximation is needed. Zero means it's up to the renderer.
RoundRectShape.Width
Width As Double
The width of the rectangle.
This example sets the Width to 150 pixels.
Var r As New RectShape
r.Width = 150
r.Height = 150
r.Border = 100
r.BorderColor = Color.Black
r.FillColor = Color.Teal
r.BorderWidth = 2.5
r.Rotation = -0.78
g.DrawObject(r)
RoundRectShape.X
X As Double
The horizontal position of the center or main anchor point.
This example sets the horizontal position to 100 pixels from the left of the containing Canvas.
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.X = 100
g.DrawObject(a)
RoundRectShape.Y
Y As Double
The vertical position (down from top) position of the center or anchor point.
This example moves the position of the arc down 100 pixels from the top of the containing Canvas.
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Y = 100
g.DrawObject(a)
Method descriptions
RoundRectShape.Contains
Contains(X As Double, Y As Double) As Boolean
Tests whether the object contains the point X, Y. Returns True if the rectangle contains the point specified by X, Y.
This code tests whether the RectShape contains the passed point:
Var r As New RectShape
r.Width = 75
r.Height = 75
r.Border = 100
r.Bordercolor = Color.Black
r.FillColor = Color.Teal
r.BorderWidth = 2.5
r.Rotation = -0.78
If r.Contains(50, 50) Then
' draw something here..
End If
g.DrawObject(r)
Sample code
The following method in the Paint event of a window draws a square with rounded corners.
Var r As New RoundRectShape
r.Width = 75
r.Height = 75
r.Border = 100
r.BorderColor = Color.RGB(0, 0, 0)
r.FillColor = Color.RGB(255, 102, 102)
r.CornerHeight = 15
r.CornerWidth = 15
r.BorderWidth = 2.5
g.DrawObject(r, 50, 50)
Compatibility
Desktop and web project types on all supported operating systems.
See also
RectShape parent class; ArcShape, CurveShape, FigureShape, FolderItem, Group2D, Graphics, OvalShape, Picture, PixmapShape, RectShape, TextShape classes.