AD
Administrator
Syncfusion Team
May 16, 2006 04:06 AM UTC
Hi Ravichandran,
To change the color of the editing row ,You need to handle the PrepareViewStyleInfo event.Here is a code snippet.
//Form Load...
this.gridControl1.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow;
int rowIndex = -1;
private void gridControl1_CurrentCellStartEditing(object sender, System.ComponentModel.CancelEventArgs e)
{
rowIndex = this.gridControl1.CurrentCell.RowIndex;
this.gridControl1.RefreshRange(GridRangeInfo.Row(rowIndex));
}
private void gridControl1_CurrentCellEditingComplete(object sender, System.EventArgs e)
{
rowIndex = -1;
}
private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex == rowIndex)
{
e.Style.BackColor = Color.Yellow;
}
}
Please let me know if this helps.
Best Regards,
Haneef
RA
Ravichandran
May 16, 2006 08:01 AM UTC
Haneef,
Thanks for your help it works fine.
Cheers
Ravi
>Hi Ravichandran,
>
>To change the color of the editing row ,You need to handle the PrepareViewStyleInfo event.Here is a code snippet.
>
>//Form Load...
>this.gridControl1.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow;
>
>int rowIndex = -1;
>private void gridControl1_CurrentCellStartEditing(object sender, System.ComponentModel.CancelEventArgs e)
>{
> rowIndex = this.gridControl1.CurrentCell.RowIndex;
> this.gridControl1.RefreshRange(GridRangeInfo.Row(rowIndex));
>}
>
>private void gridControl1_CurrentCellEditingComplete(object sender, System.EventArgs e)
>{
> rowIndex = -1;
>}
>
>private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
>{
> if(e.ColIndex > 0 && e.RowIndex == rowIndex)
> {
> e.Style.BackColor = Color.Yellow;
> }
>}
>
>Please let me know if this helps.
>Best Regards,
>Haneef
RA
Ravichandran
May 18, 2006 12:41 PM UTC
Haneef,
Once again i am opening this thread....
It works fine if I use mouse to move next row..But when I use normal up or down arrow key the code I wrriten
private void EditableGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex > 0 && (e.RowIndex - 1 == m_currentRowIndex))
{
e.Style.BackColor = Color.LightYellow;
}
}
is not working...
How to change the color of the row even I move using up and down arrow key..
Thanks
Ravi.
>Haneef,
>
>Thanks for your help it works fine.
>
>Cheers
>Ravi
>
>>Hi Ravichandran,
>>
>>To change the color of the editing row ,You need to handle the PrepareViewStyleInfo event.Here is a code snippet.
>>
>>//Form Load...
>>this.gridControl1.RefreshCurrentCellBehavior = GridRefreshCurrentCellBehavior.RefreshRow;
>>
>>int rowIndex = -1;
>>private void gridControl1_CurrentCellStartEditing(object sender, System.ComponentModel.CancelEventArgs e)
>>{
>> rowIndex = this.gridControl1.CurrentCell.RowIndex;
>> this.gridControl1.RefreshRange(GridRangeInfo.Row(rowIndex));
>>}
>>
>>private void gridControl1_CurrentCellEditingComplete(object sender, System.EventArgs e)
>>{
>> rowIndex = -1;
>>}
>>
>>private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
>>{
>> if(e.ColIndex > 0 && e.RowIndex == rowIndex)
>> {
>> e.Style.BackColor = Color.Yellow;
>> }
>>}
>>
>>Please let me know if this helps.
>>Best Regards,
>>Haneef