Me.grdSC_GSC.Model.Cols.FrozenCount = 1
''get the color you are using for your gridlines
Dim lineCol As Color = Me.grdSC_GSC.Properties.GridLineColor
Me.grdSC_GSC.Properties.FixedLinesColor = Color.FromArgb(0, Color.Red)
Me.grdSC_GSC.Model.ColStyles(1).Borders.Right = New GridBorder(GridBorderStyle.Solid, lineCol)
If you can resend your sample without setting any colwidths in the designer, maybe I can see your exact problem and offer a better suggestion.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.grdSC_GSC.Model.CutPaste.ClipboardFlags += GridDragDropFlags.NoAppendRows + GridDragDropFlags.NoAppendCols - GridDragDropFlags.Styles
Me.grdSC_GSC.Model.RowHeights(0) = 50
Me.grdSC_GSC.Model.ColWidths(0) = 75
Dim i, j As Integer
For i = 1 To 128
For j = 2 To 32
grdSC_GSC(i, j).CellValue = 201 + i
Next
Next
Dim showFrozen As Boolean = True
If showFrozen Then
'' Show a frozen line without a blue border (explicitly turning off that border below)
Me.grdSC_GSC.Model.Cols.FrozenCount = 1
Me.grdSC_GSC.Model.ColStyles(1).Borders.Right = New GridBorder(GridBorderStyle.Solid, Me.grdSC_GSC.Model.Properties.GridLineColor)
Me.grdSC_GSC.HScrollPixel = True
Else
'' Show no frozen line
Me.grdSC_GSC.Model.Cols.FrozenCount = 0
Me.grdSC_GSC.HScrollPixel = True
End If
grdSC_GSC.Visible = True
End Sub
You can toggle the showFrozen variable in order to show or not show frozen columns.
A key line in the code above is usage of horizontal pixel scrolling. This lets the grid ensure no grey area will be displayed after the last column.
I also attached form1.vb with my changes.
Stefan
Form1_6214.zip
Private Sub grdSC_GSC_QueryColWidth(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridRowColSizeEventArgs) Handles grdSC_GSC.QueryColWidth If e.Index = Me.grdSC_GSC.ColCount Then Dim w As Integer = Me.grdSC_GSC.ColWidths.GetTotal(0, Me.grdSC_GSC.Cols.FrozenCount) + Me.grdSC_GSC.ColWidths.GetTotal(Me.grdSC_GSC.LeftColIndex, Me.grdSC_GSC.ColCount - 1) e.Size = Math.Max(0, Me.grdSC_GSC.ClientSize.Width - w) e.Handled = True End If End Sub
if (hitTestInfo.colSelected && !Grid.InternalIsFrozenCol(colIndex)) { dx = Grid.ViewLayout.GetColRangeWidth(0, Grid.InternalGetFrozenCols(), GridCellSizeKind.VisibleSize); ab |= ScrollBars.Horizontal; } Grid.AutoScrolling = ab;So autoscrolling is only enabled if your start cell in not frozen. So, if you want to change this behavior, you can do your own GridDragSelectMouseController and replace this code. I am not sure what implications enabling auto scrolling that starts on a frozen cell might have for other grid behaviors. It would have to be tested. I will discuss this with Stefan to see if he knows any specific functionality that might break if you remove this check. Your tester can get the same results as autoscrolling by clicking the frozen cell, then scrolling the grid, and finally shift clicking the terminal cell.