Realbasic.Rect.Center
From Xojo Documentation
This item was deprecated in version 2019r2. Please use Rect.Center as a replacement. |
Property (As Realbasic.Point )
aRealbasic.Rect.Center = newRealbasic.PointValue
or
Realbasic.PointValue = aRealbasic.Rect.Center
Supported for all project types and targets.
or
Realbasic.PointValue = aRealbasic.Rect.Center
Supported for all project types and targets.
The center of the rect. Changing this value will move the rect.
Sample Code
This sample works in a Canvas.Paint event. It computes the center of a rect that represents the union of two rects.
Dim i, j As Integer
// To demonstrate the Union feature, draw a Cyan rectangle
// around both the draggable rects.
Dim u As Realbasic.Rect = rectone.Union(recttwo)
buffer.Graphics.ForeColor = CyanColor
buffer.Graphics.DrawRect(u.Left, u.Top, u.Width, u.Height)
theSize = u.Size
Dim theCenter As Realbasic.Point = u.Center
i = theCenter.X
j = theCenter.Y
// To demonstrate the Union feature, draw a Cyan rectangle
// around both the draggable rects.
Dim u As Realbasic.Rect = rectone.Union(recttwo)
buffer.Graphics.ForeColor = CyanColor
buffer.Graphics.DrawRect(u.Left, u.Top, u.Width, u.Height)
theSize = u.Size
Dim theCenter As Realbasic.Point = u.Center
i = theCenter.X
j = theCenter.Y