Spread Windows Forms 11.0 Product Documentation
VerticalAlignment Property (Cell)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > Cell Class : VerticalAlignment Property
Gets or sets the vertical alignment of the cell contents.
Syntax
'Declaration
 
Public Property VerticalAlignment As CellVerticalAlignment
'Usage
 
Dim instance As Cell
Dim value As CellVerticalAlignment
 
instance.VerticalAlignment = value
 
value = instance.VerticalAlignment
public CellVerticalAlignment VerticalAlignment {get; set;}

Property Value

CellVerticalAlignment object containing the vertical alignment for cell contents
Remarks

The HorizontalAlignment and VerticalAlignment properties determine the alignment of the cell's content (that is, the text) which is independent of the alignment of the cell's background image. The Picture class has a constructor for supplying alignment of the background image. This property does not apply to the rich text cell.

Valid values for this property are the vertical alignment settings listed in the VerticalAlign enumeration in the Microsoft .NET Framework Reference. The Distributed enumeration adds space between the words so that they evenly fill the cell.

For more information on cell types, refer to the FarPoint.Spread.CellType namespace and to Customizing with Cell Types.

The setting for this property can be overridden if a named style is assigned to the cell using the StyleName property, and that named style sets the vertical alignment.

Use the HorizontalAlignment property to specify the horizontal alignment of the object or text.

Example
This example locks the cell to prevent the user from editing the contents of the cell and sets the horizontal and vertical alignment for the contents of the cell.
using FarPoint.Win.Spread;
using FarPoint.Win;

private void Form1_Load(object sender, System.EventArgs e)
{
     FarPoint.Win.Spread.Cell acell;
     acell = fpSpread1.ActiveSheet.Cells[0, 0];
     fpSpread1.ActiveSheet.Cells[0, 0].Text = "Alignment";
     acell.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right;
     acell.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Top;
     acell.Locked = true;
     fpSpread1.ActiveSheet.Rows[0].Height = 80;
}
Imports FarPoint.Win.Spread
Imports FarPoint.Win

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim acell As FarPoint.Win.Spread.Cell
     acell = FpSpread1.ActiveSheet.Cells(0, 0)
     fpSpread1.ActiveSheet.Cells(0, 0).Text = "Alignment"
     acell.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right
     acell.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Top
     acell.Locked = True
     fpSpread1.ActiveSheet.Rows(0).Height = 80
End Sub
See Also

Reference

Cell Class
Cell Members
HorizontalAlignment Property