Spread Windows Forms 6.0 Product Documentation
HorizontalAlignment Property
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > NamedStyle Class : HorizontalAlignment Property


Glossary Item Box

Gets or sets the horizontal alignment for the named style.

Syntax

Visual Basic (Declaration) 
Public Overrides Property HorizontalAlignment As CellHorizontalAlignment
Visual Basic (Usage)Copy Code
Dim instance As NamedStyle
Dim value As CellHorizontalAlignment
 
instance.HorizontalAlignment = value
 
value = instance.HorizontalAlignment
C# 
public override CellHorizontalAlignment HorizontalAlignment {get; set;}

Property Value

CellHorizontalAlignment object containing the horizontal alignment for cell contents associated with this style

Example

This example sets several properties for a NamedStyle object.
C#Copy Code
FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault");
ns.BackColor = Color.LightBlue;
ns.Border = new FarPoint.Win.LineBorder(Color.DarkBlue, 2);
ns.CellType = new FarPoint.Win.Spread.CellType.TextCellType();
ns.Editor = new FarPoint.Win.Spread.CellType.TextCellType();
ns.Font = new Font("Comic Sans Serif", 12);
ns.ForeColor = Color.Red;
ns.Formatter = new FarPoint.Win.Spread.CellType.TextCellType();
ns.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right;
ns.Locked = true;
ns.Name = "StyleData";
ns.Parent = "DataAreaDefault";
ns.Renderer = new FarPoint.Win.Spread.CellType.TextCellType();
ns.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Bottom;
fpSpread1.NamedStyles.Add(ns);
fpSpread1.ActiveSheet.Cells[0, 0].StyleName = "StyleData";
fpSpread1.ActiveSheet.SetText(0, 0, "NamedStyle");
fpSpread1.ActiveSheet.Columns[0].Width = 120;
fpSpread1.ActiveSheet.Rows[0].Height = 80;
Visual BasicCopy Code
Dim ns As New FarPoint.Win.Spread.NamedStyle("StyleData", "DataAreaDefault")
ns.BackColor = Color.LightBlue
ns.Border = New FarPoint.Win.LineBorder(Color.DarkBlue, 2)
ns.CellType = New FarPoint.Win.Spread.CellType.TextCellType()
ns.Editor = New FarPoint.Win.Spread.CellType.TextCellType()
ns.Font = New Font("Comic Sans Serif", 12)
ns.ForeColor = Color.Red
ns.Formatter = New FarPoint.Win.Spread.CellType.TextCellType()
ns.HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Right
ns.Locked = True
ns.Name = "StyleData"
ns.Parent = "DataAreaDefault"
ns.Renderer = New FarPoint.Win.Spread.CellType.TextCellType()
ns.VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Bottom
FpSpread1.NamedStyles.Add(ns)
FpSpread1.ActiveSheet.Cells(0, 0).StyleName = "StyleData"
FpSpread1.ActiveSheet.SetText(0, 0, "NamedStyle")
FpSpread1.ActiveSheet.Columns(0).Width = 120
FpSpread1.ActiveSheet.Rows(0).Height = 80

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.