Description
The LocalRect
property of the GraphicsItem
class represents the local rectangular bounds of the graphics item. This property is of type Sandbox.Rect
and defines the area within which the item can be drawn or manipulated. The local rectangle is relative to the item's own coordinate system, not the scene or parent coordinate system.
Usage
Use the LocalRect
property to get or set the local bounds of a GraphicsItem
. This is useful when you need to determine the drawable area of the item or when you want to adjust its size programmatically.
For example, you might use LocalRect
to check if a point is within the item's bounds or to resize the item based on user input or other logic.
Example
// Example of accessing the LocalRect property
GraphicsItem item = new GraphicsItem();
Sandbox.Rect localBounds = item.LocalRect;
// Example of setting the LocalRect property
item.LocalRect = new Sandbox.Rect(0, 0, 100, 100);