Update: it works fine..
]]>I have the top row frozen and there was no overlap in the grid.. As you scrolled it show no half rows like it does now.. I have not check any of the other grid in the application yet..
Private Sub CreateNestedGrid()
'workbook setting
With rgMainControlContainer
'Removes the Scrollbars and Worksheet Tab Control
.SetSettings(WorkbookSettings.View_ShowScrolls Or WorkbookSettings.View_ShowSheetTabControl, False)
'Sets the control width size
Select Case cboFactorSelection.SelectedIndex
Case 0
.Width = 381
Case 1
.Width = 481
End Select
'Sets the control height size
.Height = 351
End With
'Creates the NestGrid Datatable
dtFactorData = Tools.GenerateInputLayout(FactorList, FactorListSize)
'Checks to see if there are rows are returned
If dtFactorData.Rows.Count = 0 Then Exit Sub
'WorkSheet Setting
With rgMainControl
.Reset()
'Sets the number of rows and columns
.SetRows(dtFactorData.Rows.Count + 1)
.SetCols(dtFactorData.Columns.Count)
'Sets the selection Mode
.SelectionMode = WorksheetSelectionMode.Cell
'Sets the validrange
Dim posOne As New ReoGridPos(1, .ColumnCount - 1)
Dim posTwo As New ReoGridPos(.RowCount - 1, .ColumnCount - 1)
validRange = New ReoGridRange(String.Format("{0}:{1}", posOne.ToAddress, posTwo.ToAddress))
'Sets the selection range of the validrange
.SelectionRange = New ReoGridRange(validRange.StartPos)
'Removes the RowHeader and Column Header
.SetSettings(WorksheetSettings.View_ShowRowHeader Or WorksheetSettings.View_ShowColumnHeader, False)
'Freezes the Header Row
.FreezeToCell(1, 1, FreezePosition.Top)
'Sets the column header size.
.ColumnHeaders(0).Width = 80
.ColumnHeaders(1).Width = 100
.ColumnHeaders(2).Width = 100
.ColumnHeaders(3).Width = 100
'Sets the Row Header Size
.RowHeaders(0).Height = 30
'Checks to see if the are 3 factors
If cboFactorSelection.SelectedIndex = 1 Then
.ColumnHeaders(4).Width = 100
End If
'Border Styles
.SetRangeBorders(New ReoGridRange(0, 0, .RowCount, .ColumnCount), BorderPositions.All, _
New RangeBorderStyle() With {.Color = ColorTranslator.FromWin32(RGB(89, 89, 89)),
.Style = BorderLineStyle.Solid})
'Sets Text Alignment
.SetRangeStyles(New ReoGridRange(0, 0, .RowCount, .ColumnCount),
New WorksheetRangeStyle() With {.Flag = PlainStyleFlag.AlignAll,
.HAlign = ReoGridHorAlign.Center,
.VAlign = ReoGridVerAlign.Middle})
'Sets the Header Row Styles
.SetRangeStyles(New ReoGridRange(0, 0, 1, .ColumnCount),
New WorksheetRangeStyle() With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor Or PlainStyleFlag.FontStyleBold _
Or PlainStyleFlag.TextWrap,
.BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
.TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166)),
.Bold = True,
.TextWrapMode = TextWrapMode.WordBreak})
'Sets the Background Colors
.SetRangeStyles(New ReoGridRange(1, 0, (.RowCount - 1), (.ColumnCount - 1)),
New WorksheetRangeStyle() With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
.BackColor = ColorTranslator.FromWin32(RGB(50, 50, 50)),
.TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})
'Sets the background color and forecolor for last column cells
.SetRangeStyles(New ReoGridRange(1, (.ColumnCount - 1), (.RowCount - 1), 1),
New WorksheetRangeStyle() With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize,
.BackColor = Color.Black,
.TextColor = Color.White,
.FontSize = 8})
'Sets Readonly on the header row
For i As Integer = 0 To .ColumnCount - 1
.Cells(0, i).IsReadOnly = True
Next
'Sets Readonly on the display cells
For i As Integer = 1 To .RowCount - 1
For j As Integer = 0 To .ColumnCount - 2
.Cells(i, j).IsReadOnly = True
Next
Next
'Sets the Row Header Titles
Select Case cboFactorSelection.SelectedIndex
Case 0
.SetCellData("A1", "Run")
.SetCellData("B1", IsNullOrEmpty(txtFactorADescription.Text, "Factor A"))
.SetCellData("C1", IsNullOrEmpty(txtFactorBDescription.Text, "Factor B"))
.SetCellData("D1", IsNullOrEmpty(txtGreenY.Text, "GreenY"))
Case 1
.SetCellData("A1", "Run")
.SetCellData("B1", IsNullOrEmpty(txtFactorADescription.Text, "Factor A"))
.SetCellData("C1", IsNullOrEmpty(txtFactorBDescription.Text, "Factor B"))
.SetCellData("D1", IsNullOrEmpty(txtFactorCDescription.Text, "Factor C"))
.SetCellData("E1", IsNullOrEmpty(txtGreenY.Text, "GreenY"))
End Select
'Fills the grid from the datatable
For i As Integer = 0 To dtFactorData.Rows.Count - 1
For j As Integer = 0 To dtFactorData.Columns.Count - 1
.Cells((i + 1), j).DataFormat = DataFormat.CellDataFormatFlag.Text
.Cells((i + 1), j).Data = dtFactorData.Rows(i)(j).ToString()
Next
Next
'Sets the cell position
.FocusPos = New ReoGridPos(1, (.ColumnCount - 1))
End With
'Enables the has been setup for the grid
m_blnHasBeenSetup = True
End Sub
This code i use to create the spreadsheet grid.. i have not change anything, but name changes you made to methods and functions.
Shane
]]>