Class

# RoundRectShape

<div class="rst-class">

forsearch

</div>

Shape

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Draws a (two-dimensional) rounded rectangle in a vector graphics environment.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                          | Type                               | Read-Only | Shared |
|-----------------------------------------------|------------------------------------|-----------|--------|
| `BorderColor<roundrectshape.bordercolor>`     | `Color</api/data_types/color>`     |           |        |
| `BorderOpacity<roundrectshape.borderopacity>` | `Double</api/data_types/double>`   |           |        |
| `BorderWidth<roundrectshape.borderwidth>`     | `Double</api/data_types/double>`   |           |        |
| `CornerHeight<roundrectshape.cornerheight>`   | `Double</api/data_types/double>`   |           |        |
| `CornerWidth<roundrectshape.cornerwidth>`     | `Double</api/data_types/double>`   |           |        |
| `FillColor<roundrectshape.fillcolor>`         | `Color</api/data_types/color>`     |           |        |
| `FillOpacity<roundrectshape.fillopacity>`     | `Double</api/data_types/double>`   |           |        |
| `Height<roundrectshape.height>`               | `Double</api/data_types/double>`   |           |        |
| `Rotation<roundrectshape.rotation>`           | `Double</api/data_types/double>`   |           |        |
| `Scale<roundrectshape.scale>`                 | `Double</api/data_types/double>`   |           |        |
| `Segments<roundrectshape.segments>`           | `Integer</api/data_types/integer>` |           |        |
| `Width<roundrectshape.width>`                 | `Double</api/data_types/double>`   |           |        |
| `X<roundrectshape.x>`                         | `Double</api/data_types/double>`   |           |        |
| `Y<roundrectshape.y>`                         | `Double</api/data_types/double>`   |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                | Parameters                                                                   | Returns                            | Shared |
|-------------------------------------|------------------------------------------------------------------------------|------------------------------------|--------|
| `Contains<roundrectshape.contains>` | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>` | `Boolean</api/data_types/boolean>` |        |

## Property descriptions

<div id="roundrectshape.bordercolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.BorderColor

**BorderColor** As `Color</api/data_types/color>`

> The color of the object's border.

<div id="roundrectshape.borderopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.BorderOpacity

**BorderOpacity** As `Double</api/data_types/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 a rounded rectangle:
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 200
> shape.Y = 200
> shape.BorderColor = Color.Blue     
> shape.BorderOpacity = 50
> shape.BorderWidth = 3.0        
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.borderwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.BorderWidth

**BorderWidth** As `Double</api/data_types/double>`

> The width of the border, in points. The default is 1.
>
> The width a `Double</api/data_types/double>` value with a default of 1.0.

<div id="roundrectshape.cornerheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.CornerHeight

**CornerHeight** As `Double</api/data_types/double>`

> The height of the inset corner oval.

<div id="roundrectshape.cornerwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.CornerWidth

**CornerWidth** As `Double</api/data_types/double>`

> The width of the inset corner oval.

<div id="roundrectshape.fillcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.FillColor

**FillColor** As `Color</api/data_types/color>`

> The color of the interior of the shape.

<div id="roundrectshape.fillopacity">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.FillOpacity

**FillOpacity** As `Double</api/data_types/double>`

> The opacity of the interior, from 0 (completely transparent) to 100 (opaque).
>
> This example sets the Fill to 50% opacity.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 200
> shape.Y = 200
>
> shape.BorderColor = Color.Blue
> shape.BorderOpacity = 50
> shape.BorderWidth = 3.0
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
> shape.FillOpacity = 50
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Height

**Height** As `Double</api/data_types/double>`

> The height of the rectangle.
>
> This example sets the height and width of the shape to 150 pixels.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 150
> shape.Y = 150
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.rotation">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Rotation

**Rotation** As `Double</api/data_types/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 rounded rectangle 0.9 radians.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 150
> shape.Y = 150
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
> shape.Rotation = 0.9
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.scale">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Scale

**Scale** As `Double</api/data_types/double>`

> The scaling factor relative to the object's original size.
>
> The following code rescales the rounded rectangle by a factor of 1.5.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 150
> shape.Y = 150
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
> shape.Scale = 1.5
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.segments">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Segments

**Segments** As `Integer</api/data_types/integer>`

> The number of polygon sides to use when approximation is needed. Zero means it's up to the renderer.

<div id="roundrectshape.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Width

**Width** As `Double</api/data_types/double>`

> The width of the rectangle.
>
> This example sets the Width to 150 pixels.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 150
> shape.Y = 150
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.x">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.X

**X** As `Double</api/data_types/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</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 100
> shape.Y = 150
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
>
> g.DrawObject(shape)
> ```

<div id="roundrectshape.y">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Y

**Y** As `Double</api/data_types/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</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.X = 150
> shape.Y = 100
>
> shape.CornerWidth = 16
> shape.CornerHeight = 16
> shape.FillColor = Color.Red
>
> g.DrawObject(shape)
> ```

## Method descriptions

<div id="roundrectshape.contains">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

RoundRectShape.Contains

**Contains**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`) As `Boolean</api/data_types/boolean>`

> Tests whether the object contains the point *x*, *y*. Returns `True</api/language/true>` if the rectangle contains the point specified by *x*, *y*.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> If you want to use Contains, make sure to set the *X* and *Y* properties and **do not** pass the these to the `Graphics.DrawObject<graphics.drawobject>` method. `Graphics.DrawObject<graphics.drawobject>` parameters are the offset where the object will be drawn.
>
> </div>
>
> This code tests whether the <span class="title-ref">RoundRectShape</span> contains the passed point:
>
> ``` xojo
> Var shape As New RoundRectShape
>
> shape.Width = 75
> shape.Height = 75
> shape.BorderOpacity = 100
> shape.Bordercolor = Color.Black
> shape.FillColor = Color.Teal
> shape.BorderWidth = 2.5
> shape.Rotation = -0.78
>
> If shape.Contains(50, 50) Then
> ' draw something here..
> End If
>
> g.DrawObject(shape)
> ```

## Sample code

The following method in the Paint event of a window draws a square with rounded corners.

``` xojo
Var shape As New RoundRectShape

shape.Width = 75
shape.Height = 75
shape.BorderOpacity = 100
shape.BorderColor = Color.RGB(0, 0, 0)
shape.BorderWidth = 2.5    
shape.FillColor = Color.RGB(255, 102, 102)
shape.CornerHeight = 15
shape.CornerWidth = 15

g.DrawObject(shape, 50, 50)
```

## Compatibility

|                       |                       |
|-----------------------|-----------------------|
| **Project Types**     | Console, Desktop, Web |
| **Operating Systems** | All                   |

<div class="seealso">

`RectShape</api/graphics/rectshape>` parent class; `ArcShape</api/graphics/arcshape>`, `CurveShape</api/graphics/curveshape>`, `FigureShape</api/graphics/figureshape>`, `FolderItem</api/files/folderitem>`, `Group2D</api/graphics/group2d>`, `Graphics</api/graphics/graphics>`, `OvalShape</api/graphics/ovalshape>`, `Picture</api/graphics/picture>`, `PixmapShape</api/graphics/pixmapshape>`, `RectShape</api/graphics/rectshape>`, `TextShape</api/graphics/textshape>` classes.

</div>
