Rect SelectionRect { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The SelectionRect property of the Editor.GraphicsView class represents a rectangular area within the graphics view. All items that fall within this rectangle will be selected. This property is useful for implementing selection tools in graphical editors, allowing users to select multiple items by defining a rectangular area.

Usage

To use the SelectionRect property, you can set it to a new Sandbox.Rect that defines the area you want to select. The property is read-write, so you can also retrieve the current selection rectangle.

Example usage:

GraphicsView graphicsView = new GraphicsView();
Sandbox.Rect selectionArea = new Sandbox.Rect(10, 10, 100, 100);
graphicsView.SelectionRect = selectionArea;

In this example, a new Sandbox.Rect is created with a position of (10, 10) and a size of 100x100. This rectangle is then assigned to the SelectionRect property of a GraphicsView instance, selecting all items within that area.

Example

GraphicsView graphicsView = new GraphicsView();
Sandbox.Rect selectionArea = new Sandbox.Rect(10, 10, 100, 100);
graphicsView.SelectionRect = selectionArea;