This sample demonstrates the addition of Excel-Like comments in grid cells. A custom mousecontroller implementing IMouseController interface has been created to display comments for each cell..
Features:
The comments to the cells are binded based on the record id.
To change, add, or delete a comment, you must right click the cell, or left click the red corner.
The comment window shown is a form with a rich text box.
A red comment indicator is drawn in the cell-drawn handler using the graphics class FillPolygon function.
A black arrow is drawn when the mouse pointer hovers over the comment indicator using the graphics class FillPolygon and DrawLine function.
When the mouse pointer hovers over the comment indicator through the PointToRowCol function, it is converted to a row index on the layout using the ViewLayout.RowIndexToVisibleClient. Then it is converted to drawing points using the ViewLayout.ClientRowColToPoint function.
The comments for respective record cells, display accordingly eventhough grouping or filtering is applied in grid.
Here is the image:
Here is a sample code snippet:
//create the Comment mousecontroller. commentMouseController = new CommentMouseController(gridGroupingControl1.TableControl,comments); //allow context menu to edit/add comments commentMouseController.ContextMenuEnabled = true; //register the controller gridGroupingControl1.TableControl.MouseControllerDispatcher.Add(commentMouseController);