public class CustomBorder : FarPoint.Win.Spread.ISelectionRenderer
{
public void PaintSelection(Graphics g, int x, int y, int width, int height)
{
if (width > 0 && height > 0)
{
int penWidthLeft = 2;
int penWidthRight = 5;
Pen selectionLeftPen = new Pen(Color.Red, penWidthLeft);
Pen selectionRightPen = new Pen(Color.Blue, penWidthRight);
int align = 0;
g.DrawLine(selectionLeftPen, x+penWidthLeft/2, y, x+penWidthLeft/2, y+height);
if (penWidthRight%2 > 0)
align = 1;
g.DrawLine(selectionRightPen, x+width-align-penWidthRight/2, y, x+width-align-penWidthRight/2, y+height);
selectionLeftPen.Dispose();
selectionRightPen.Dispose();
}
}
}
private void SetSelectionRenderer(object sender, System.EventArgs e)
{
FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook();
sv.SelectionRenderer = new CustomBorder();
}