You can create a snapshot of a range of cells and use that as a shape in the Spread control. The cell range can contain other shapes including charts. The following image displays a camera shape that contains a chart.
For more information about using the designer to add camera shapes, see the Insert Menu. In general, properties that apply to the interior of the shape, do not apply to the camera shape.
Return to the overview of Customizing Drawing.
Using Code
- Create a camera shape object by using the SpreadCameraShape class.
- Specify the range of cells that will become the shape with the Formula property .
- Set any other shape properties.
- Add the camera shape to the sheet.
Example
This example creates a blue triangle, adds text to a cell, and creates a camera shape that includes both. The following image displays a camera shape that contains a triangle shape and a cell with text.
C# | Copy Code |
---|---|
fpSpread1.Sheets[0].Cells[1, 3].Text = "Test"; FarPoint.Win.Spread.DrawingSpace.TriangleShape a = new FarPoint.Win.Spread.DrawingSpace.TriangleShape(); a.BackColor = Color.Blue; fpSpread1.ActiveSheet.AddShape(a, 1, 1); FarPoint.Win.Spread.DrawingSpace.SpreadCameraShape test = new FarPoint.Win.Spread.DrawingSpace.SpreadCameraShape(); test.Formula = "B1:D6"; test.Location = new System.Drawing.Point(20, 20); fpSpread1.Sheets[0].AddShape(test); |
VB | Copy Code |
---|---|
FpSpread1.Sheets(0).Cells(1, 3).Text = "Test" Dim a As New FarPoint.Win.Spread.DrawingSpace.TriangleShape a.BackColor = Color.Blue FpSpread1.ActiveSheet.AddShape(a, 1, 1) Dim test As New FarPoint.Win.Spread.DrawingSpace.SpreadCameraShape() test.Formula = "B1:D6" test.Location = New System.Drawing.Point(20, 20) FpSpread1.Sheets(0).AddShape(test) |
Using the Spread Designer
- Select a block of cells in the designer.
- Select the Insert menu.
- Select the camera shape icon.
- Click on the shape to move it.
- The Drawing Tools menu with additional options is displayed.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.