This sample demonstrates the addition of Excel-style comments to a grid. The sample contains a class library assembly, which can be used in projects to display the Excel comment functionality in your grid. The derived mouse controller in the class library performs the action.
Features:
The comment text is a custom style property added to cells that hold comments.
To change, add, or delete a cell comment, you have to click the cell using right mouse button, or click the red flag at the top right corner. A context menu with options pops up. The required option can be selected to perform respective operations.
The comment window displayed 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 is hovered 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.