ts-drawing-components-ellipse.md 1.5 KB
Newer Older
Z
zengyawen 已提交
1
# Ellipse
Z
zengyawen 已提交
2

Z
zengyawen 已提交
3

4
> **NOTE**<br>
Z
zengyawen 已提交
5
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Z
zengyawen 已提交
6

Z
zengyawen 已提交
7

8
The **<Ellipse\>** component is used to draw an ellipse.
Z
zengyawen 已提交
9 10 11


## Required Permissions
Z
zengyawen 已提交
12 13 14

None

Z
zengyawen 已提交
15 16

## Child Components
Z
zengyawen 已提交
17 18 19 20

None


Z
zengyawen 已提交
21 22 23 24 25
## APIs

ellipse(options?: {width: Length, height: Length})

- Parameters
26
  | Name | Type | Mandatory | Default Value | Description | 
Z
zengyawen 已提交
27
  | -------- | -------- | -------- | -------- | -------- |
28
  | options | Object | No | - | Options of the ellipse to draw. For details, see the **options** parameters. | 
Z
zengyawen 已提交
29 30

- options parameters
31
  | Name | Type | Mandatory | Default Value | Description | 
Z
zengyawen 已提交
32
  | -------- | -------- | -------- | -------- | -------- |
33 34
  | width | Length | Yes | - | Width of the ellipse. | 
  | height | Length | Yes | - | Height of the ellipse. | 
Z
zengyawen 已提交
35 36 37 38


## Attributes

39
| Name | Type | Default Value | Mandatory | Description | 
Z
zengyawen 已提交
40
| -------- | -------- | -------- | -------- | -------- |
E
esterzhou 已提交
41 42
| width | Length | 0 | No | Width of the rectangle where the ellipse is located. | 
| height | Length | 0 | No | Height of the rectangle where the ellipse is located. | 
Z
zengyawen 已提交
43 44 45 46 47


## Example

  
Z
zengyawen 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
```
@Entry
@Component
struct EllipseExample {
  build() {
    Flex({ justifyContent: FlexAlign.SpaceAround }) {
      // Draw an ellipse in a 150 x 70 rectangle.
      Ellipse({ width: 150, height: 80 })
      // Draw an ellipse in a 150 x 70 rectangle.
      Ellipse().width(150).height(80)
    }.width('100%').margin({ top: 5 })
  }
}
```

Z
zengyawen 已提交
63
![en-us_image_0000001212058488](figures/en-us_image_0000001212058488.png)