Difference between revisions of "RectShape"

From Xojo Documentation

m (1 revision)
 
(Examples)
 
(21 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
{{ClassBox
 +
| super=[[Object2D]]
 +
| platform=all
 +
| scope=global
 +
}}
 +
{{Description
 +
|text = Draws a two-dimensional rectangle in a vector graphics environment. }}
  
 +
<dynamicTable id="Properties" super="Object2D" class="propertyTable" title="Properties" columns="3">
 +
{{Property | name=Height | type=Double | platform=all | description=( Double)&nbsp;&nbsp;The height of the rectangle. }}
 +
{{Property | name=Width | type=Double | platform=all | description=( Double)&nbsp;&nbsp;The width of the rectangle. }}
 +
</dynamicTable>
  
=='''Description'''==
 
Draws a (two-dimensional) rectangle in a vector graphics environment.
 
  
 +
<dynamicTable id="Methods" inherits="Object2D" class="methodTable" title="Methods" columns="2">
 +
{{Method | name=Contains | params=X as [[Double]],  Y as [[Double]] | returntype=[[Boolean]] | description=Contains(X as Double,  Y as Double) as Boolean&#x0A;Tests whether the object contains the point X,Y }}
 +
</dynamicTable>
  
 +
==Examples==
 +
The following code in the [[Canvas.Paint]] event handler draws a diamond shaped rectangle:
  
=='''Super Class'''==
+
<rbcode>
[[Object2D|Object2D]]
+
Var r As New RectShape
 +
r.Width = 75
 +
r.Height = 75
 +
r.BorderOpacity = 100
 +
r.BorderColor = RGB(0, 0, 0) // black
 +
r.FillColor = RGB(0, 127, 127) // teal
 +
r.BorderWidth = 2.5
 +
r.Rotation = -0.78
 +
g.DrawObject(r, 100, 100)
 +
</rbcode>
  
=='''Properties'''==
+
==See Also==
 +
[[ArcShape]], [[CurveShape]], [[FigureShape]], [[FolderItem]], [[Group2D]], [[Graphics]], [[OvalShape]], [[Picture]], [[PixmapShape]], [[RoundRectShape]], [[TextShape]] classes.
  
{| cellpadding="8" cellspacing="0" border="1"
 
  
! width=10%  style="background-color:#e0e0e0" | Name
+
[[Category:Graphics/Multimedia_Graphics]]
 
+
[[Category:Graphics/Multimedia_Vector_Graphics]]
! width=15%  style="background-color:#e0e0e0" | Type
+
[[Category:Language_Classes]]
 
 
! width=55%  style="background-color:#e0e0e0" | Description
 
|-
 
|Height
 
 
 
|[[Double|Double]]
 
|The height of the rectangle.
 
 
 
|-
 
|Width
 
 
 
|[[Double|Double]]
 
|The width of the rectangle.
 
 
 
|-
 
|}
 
 
 
 
 
=='''Methods'''==
 
 
 
{| cellpadding="8" cellspacing="0" border="1"
 
 
 
! width=10%  style="background-color:#e0e0e0" | Name
 
 
 
! width=20%  style="background-color:#e0e0e0" | Parameters
 
 
 
! width=25%  style="background-color:#e0e0e0" | Return Type
 
 
 
! width=55%  style="background-color:#e0e0e0" | Description
 
|-
 
|Contains
 
 
 
|X as [[Double|Double]], Y as [[Double|Double]]
 
|[[Boolean|Boolean]]
 
|Tests whether the object contains the point X,Y. Returns [[True|True]] if the rectangle contains the point specified by X,Y.
 
 
 
|-
 
|}
 
 
 
 
 
=='''Examples'''==
 
The following code in the Paint event of a [[WindowClass|window]] draws a diamond shaped rectangle.
 
{| cellpadding="8" cellspacing="0" border="1"
 
|<div style="width:100%; background-color:#d0d0d0; padding-left:30px">[[Dim|Dim]] r as [[New|New]] '''RectShape'''<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.width=75
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.height=75
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.border=100
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.bordercolor=[[RGB|RGB]](0,0,0) //black
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.fillcolor=[[RGB|RGB]](0,127,127) // teal
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.borderwidth=2.5
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">r.rotation=-.78
 
<br /></div>
 
<div style="width:100%; background-color:#d0d0d0; padding-left:30px">g.DrawObject r,100,100
 
<br /></div>
 
 
 
|-
 
|}
 
 
 
 
 
=='''See Also'''==
 
[[ArcShape|ArcShape]], [[CurveShape|CurveShape]], [[FigureShape|FigureShape]], [[FolderItem|FolderItem]], [[Group2D|Group2D]], [[Graphics|Graphics]], [[OvalShape|OvalShape]], [[Picture|Picture]], [[PixmapShape|PixmapShape]], [[RoundRectShape|RoundRectShape]], [[StringShape|StringShape]] classes.
 
 
 
 
 
[[Category:Classes]]
 
[[Category:Graphics]]
 
[[Category:Vector_Graphics]]
 

Latest revision as of 14:06, 5 March 2020

Class (inherits from Object2D)

Draws a two-dimensional rectangle in a vector graphics environment.

Properties
BorderColor FillOpacity Width
BorderOpacity Height X
BorderWidth Rotation Y
FillColor Scale


Methods
Contains

Examples

The following code in the Canvas.Paint event handler draws a diamond shaped rectangle:

Var r As New RectShape
r.Width = 75
r.Height = 75
r.BorderOpacity = 100
r.BorderColor = RGB(0, 0, 0) // black
r.FillColor = RGB(0, 127, 127) // teal
r.BorderWidth = 2.5
r.Rotation = -0.78
g.DrawObject(r, 100, 100)

See Also

ArcShape, CurveShape, FigureShape, FolderItem, Group2D, Graphics, OvalShape, Picture, PixmapShape, RoundRectShape, TextShape classes.