ColAlignment Property

See Also39C1ZXU              Example2G9PMT>Low

Applies To

Grid2VGT0PT.

Description

Determines the alignment of data in a column.  Not available at design time.

Usage

[form.]grid.ColAlignment(column)[ = numericexpression ]

Setting

The ColAlignment property settings are:

Setting         Description

 

0                  (Default) Left align

1                  Right align

2                  Center

 

Remarks

Any column can have an alignment that is different from other columns.  This property does not affect cells in a fixed row.  To set the alignment for a fixed column, use the FixedAlignment1NM2GHO property.

Data Type

IntegerDOKXHY (Enumerated)


See Also

Help:

Alignment PropertyFQ8OZH

FixedAlignment Property1NM2GHO

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"


ColAlignment Property Example

The example fills a grid with the letter "m" and then sets the column alignment to right-aligned for every other column.  To try this example, use the Add File command on the File menu to add GRID.VBX to the project, and then draw a grid on a new form.  To run the program, press F5.

Sub Form_Load ()

   Grid1.Cols = 5                  ' Set Cols and Rows.

   Grid1.Rows = 8

   ' Select all cells

   Grid1.SelStartCol = 1

   Grid1.SelStartRow = 1

   Grid1.SelEndCol = Grid1.Cols - 1

   Grid1.SelEndRow = Grid1.Rows - 1

   ' Fill all cells with a letter

   Grid1.FillStyle = 1             ' Turn on FillStyle.

   Grid1.Text = "m"

   ' Set ColAlignment for even numbered columns

   For I = 2 To 4 Step 2

      Grid1.ColAlignment(I) = 1    ' Right align.

   Next I

   Grid1.FillStyle = 0             ' Turn off FillStyle.

End Sub