1&3 - One of the lines defining the range for your covered columns was probably not correct.
private void programGridNew_QueryCoveredRange(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCoveredRangeEventArgs e)
{
if(e.RowIndex == 0 && e.ColIndex > 0)
{
if(e.ColIndex % 2 == 1)
{
e.Range = GridRangeInfo.Cells(0 ,e.ColIndex,0,e.ColIndex+1);
}
else
{
//e.Range = GridRangeInfo.Cells(e.ColIndex - 1, 0, e.ColIndex , 0);
e.Range = GridRangeInfo.Cells(0, e.ColIndex - 1, 0, e.ColIndex ); //changed
}
e.Handled = true;
} //added the else
else if (totalitemdisplay > 2)
{
this.programGridNew.RowCount = 12;
if(e.ColIndex == 0 && e.RowIndex > 0)
{
if(e.RowIndex % 2 == 1)
{ //odd row
e.Range = GridRangeInfo.Cells(e.RowIndex , 0, e.RowIndex + 1, 0);
}
else
{
//even row
e.Range = GridRangeInfo.Cells(e.RowIndex - 1, 0, e.RowIndex , 0);
}
e.Handled = true;
}
}
}
Making the change above seemed to make the scrolling work OK for me.
In regard to the speed, any code that you place in PrepareViewStyleInfo should be written as efficiently as possible. In the code, you have a whole series of if statements. They are not organized, and do not use else clauses to skip over blocks of code when possible. For example, you have these three IFs in a row.
if (totalitemdisplay == 1 && e.ColIndex%2 == 1)
{
e.Style.CellValue = e.ColIndex +"."+ e.RowIndex ;
}
if (totalitemdisplay == 2 && e.ColIndex%2 == 1)
{
e.Style.CellValue = e.ColIndex +"."+ e.RowIndex ;
}
if (totalitemdisplay == 2 && e.ColIndex%2 == 0)
{
e.Style.CellValue = e.ColIndex +"."+ e.RowIndex ;
}
All three IFs will always be hit. If you used elseif for the last 2 IF''s, then a majority of the time, the last IF would never be encountered. Spending time optimizing the code in PrepareViewStyleInfo will be beneficial.