This is a SpreadsheetGear Grid specific question. I know you can add a comment to a cell and the cell gets red triangle marker at the top right corner automatically. But I have a need to add a small triangle (different color) to any cell corner to indicate something special. Is it possible to do it?
UPATE: This is what I got for adding a triangle to any corner of the cell based on Daniel's suggestion.
public void AddTriangleShapeToCorner(IWorksheet worksheet, int row, int col, CellCorners cellCorner)
{
const double width = 5, height = 5;
double xOffset = 0, yOffset = 0;
IWorksheetWindowInfo windowInfo = worksheet.WindowInfo;
if (cellCorner == CellCorners.TopRight || cellCorner == CellCorners.BottomRight)
{
col++;
xOffset = width;
}
if (cellCorner == CellCorners.BottomLeft || cellCorner == CellCorners.BottomRight)
{
row++;
yOffset = height;
}
double top = windowInfo.RowToPoints(row) - yOffset;
double left = windowInfo.ColumnToPoints(col) - xOffset;
IShape shape = worksheet.Shapes.AddShape(AutoShapeType.RightTriangle, left, top, width, height);
shape.Line.Visible = false; // line at top-left corner is not sharp, so turn it off.
shape.Placement = Placement.Move; // make the shape move with cell. NOTE: it doesn't work for top-right and bottom-right corners.
if (cellCorner == CellCorners.TopLeft || cellCorner == CellCorners.TopRight)
shape.VerticalFlip = true;
if (cellCorner == CellCorners.TopRight || cellCorner == CellCorners.BottomRight)
shape.HorizontalFlip = true;
}