We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

VisibleCell

Hi all,
how can i find out if a cell is visible? For visible I mean the user can see it. For example a cell covered by another window is not visible.
Is it possible to have this information?



3 Replies

AD Administrator Syncfusion Team May 22, 2008 01:49 PM UTC

Hi ML,

Thanks for the interest in Syncfusion Grid.

It is not possible to find out the visible cell(covered by another window). But you can calculate the number of visible rows and column in a Grid. Please refer the following code snippet for more detail.


//To Calculate the number of visible rows in a Grid.
int visibleRows = this.gridControl1.ViewLayout.LastVisibleRow - this.gridControl1.TopRowIndex;
//To Calculate the number of visible columns in a Grid.
int visibleCols = this.gridControl1.ViewLayout.LastVisibleCol - this.gridControl1.LeftColIndex;
//To set the TopRowIndex for changing the Row view of the Grid.
this.gridControl1.TopRowIndex = RowIndex - visibleRows/2;
//To set the LeftColIndex for changing the Column view of the Grid.
this.gridControl1.LeftColIndex = ColIndex - visibleCols/2;



Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/I73724/main.htm

Please let me know if you have any questions.

Regards,
Asem.



ML mattia locatelli May 23, 2008 08:58 AM UTC

Hi,
Thanks for the reply.
I'm using the PaintElement method to repaint some cells and I see that even if the grid is completly covered by another window it seems that the cells are painted ( I can see this by the CPU usage ), but if instead I use the InvalidateRange method to invalidate the cells, if the grid is covered by another window the cells are not repainted (the CPU usage is 0). What is the difference between the two ? Why with the invalidateRange method the grid doesn't repaint the hidden cell ?

>Hi ML,

Thanks for the interest in Syncfusion Grid.

It is not possible to find out the visible cell(covered by another window). But you can calculate the number of visible rows and column in a Grid. Please refer the following code snippet for more detail.


//To Calculate the number of visible rows in a Grid.
int visibleRows = this.gridControl1.ViewLayout.LastVisibleRow - this.gridControl1.TopRowIndex;
//To Calculate the number of visible columns in a Grid.
int visibleCols = this.gridControl1.ViewLayout.LastVisibleCol - this.gridControl1.LeftColIndex;
//To set the TopRowIndex for changing the Row view of the Grid.
this.gridControl1.TopRowIndex = RowIndex - visibleRows/2;
//To set the LeftColIndex for changing the Column view of the Grid.
this.gridControl1.LeftColIndex = ColIndex - visibleCols/2;



Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/I73724/main.htm

Please let me know if you have any questions.

Regards,
Asem.





AD Administrator Syncfusion Team June 2, 2008 04:15 PM UTC

Hi all,
is there any response to my question ?

Thanks.
ML

>Hi,
Thanks for the reply.
I'm using the PaintElement method to repaint some cells and I see that even if the grid is completly covered by another window it seems that the cells are painted ( I can see this by the CPU usage ), but if instead I use the InvalidateRange method to invalidate the cells, if the grid is covered by another window the cells are not repainted (the CPU usage is 0). What is the difference between the two ? Why with the invalidateRange method the grid doesn't repaint the hidden cell ?

>Hi ML,

Thanks for the interest in Syncfusion Grid.

It is not possible to find out the visible cell(covered by another window). But you can calculate the number of visible rows and column in a Grid. Please refer the following code snippet for more detail.


//To Calculate the number of visible rows in a Grid.
int visibleRows = this.gridControl1.ViewLayout.LastVisibleRow - this.gridControl1.TopRowIndex;
//To Calculate the number of visible columns in a Grid.
int visibleCols = this.gridControl1.ViewLayout.LastVisibleCol - this.gridControl1.LeftColIndex;
//To set the TopRowIndex for changing the Row view of the Grid.
this.gridControl1.TopRowIndex = RowIndex - visibleRows/2;
//To set the LeftColIndex for changing the Column view of the Grid.
this.gridControl1.LeftColIndex = ColIndex - visibleCols/2;



Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/I73724/main.htm

Please let me know if you have any questions.

Regards,
Asem.






Loader.
Live Chat Icon For mobile
Up arrow icon