From Xojo Documentation


Rect.SplitHorizontal(X As Double) As Rect

New in 2019r2

Supported for all project types and targets.

Divides the rect into two rects at the given point on the X axis.


For example, imagine a rect that is 200 pixels wide by 100 pixels tall. With a call to SplitHorizontal(50), the rect will become 50 pixels wide, and a new rect will be returned that is 150x100, positioned exactly to the right of the original rect.

Sample Code

This example is taken from the Paint event of a Canvas. It takes a rect and splits it horizontally at the midpoint of the width.

Var uright As Rect = u.SplitHorizontal(theSize.Width / 2)