Draws a border around and within the selected cells.
Syntax
[form!]VSFlexGrid.CellBorder Color As OLE_COLOR, Left As Integer, Top As Integer, Right As Integer, Bottom As Integer, Vertical As Integer, Horizontal As Integer
Remarks
The CellBorder method allows you to draw borders around groups of cells. It works on the current selection, so in order to use it, you must start by selecting the group of cells where the border is to be drawn. Then call the CellBorder method using the following parameters:
Color As OLE_COLOR
This parameter determines the color of the border.
Left, Top, Right, Bottom As Integer
These parameters specify the width, in pixels, of the border to be drawn around the selection. Specify zero to remove the border, or any negative number to preserve the existing border.
Vertical, Horizontal As Integer
These parameters specify the width, in pixels, of the borders to be drawn inside the selection in the vertical and horizontal directions. Specify zero to remove the border, or any negative number to preserve the width of the existing border.
For example, the code below draws blue borders around a selected range:
Private Sub Form_Load()
' draw borders around a table
fg.Select 1, 1, 4, 4
fg.CellBorder RGB(0, 0, 125), 2, 3, 2, 2, 1, 1
' apply special formatting to first line of table
fg.Select 1, 1, 1, 4
fg.CellBorder RGB(0, 0, 125), -1, -1, -1, 3, 0, 0
End Sub
The result looks like this: