You can set the overall dimensions of the Spread component and this determines the size of the visible area of the spreadsheet. The following figure shows the dimensions that you can set by setting the number of pixels for each.
Refer to the Microsoft .NET Framework documentation for more details on the Control.Height property or Control.Width property.
To calculate the height of the Spread, assuming scroll bars turned off and no headers, calculate the height of all the rows and then add one pixel for every border, so if 10 rows of 20 pixel height, (10 x 20) + (10 x 1) + 1, or 211 in this example. For width of the Spread, the process is the same. For more information on setting the row height and column width, refer to Setting the Row Height or Column Width.
Using the Properties Window
This way of setting the dimensions is done at design time and uses the Properties window of Visual Studio .NET.
- Select the Spread component.
- With the properties window open, in the Layout category, select the Height property or the Width property and type in a new value. The unit is pixels. Press Enter. The new dimension is now set.
Refer to the Microsoft .NET Framework documentation for setting the units of measurement for height to something other than the default, which is pixels.
Using Code
This way of setting the dimensions is done in code and is not seen until run time.
Add a line of code that sets the specific dimension. Unless you have set it otherwise, the default for the unit of measurement is pixels. Use the Height and Width properties of the FpSpread class.
Example
This example shows how to set the height of the Spread component to 250 pixels and the width to 300.
C# | Copy Code |
---|---|
fpSpread1.Height = 250; fpSpread1.Width = 300; |
VB | Copy Code |
---|---|
FpSpread1.Height = 250 FpSpread1.Width = 300 |