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();
}
Public Class CustomBorder
Implements FarPoint.Win.Spread.ISelectionRenderer
Public Sub PaintSelection(ByVal g As Graphics, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height
As Integer) Implements FarPoint.Win.Spread.ISelectionRenderer.PaintSelection
If (width > 0 And height > 0) Then
Dim penWidthLeft As Single = 2
Dim penWidthRight As Single = 5
Dim selectionLeftPen As New Pen(Color.Red, penWidthLeft)
Dim selectionRightPen As New Pen(Color.Blue, penWidthRight)
Dim align As Integer = 0
g.DrawLine(selectionLeftPen, x + penWidthLeft / 2, y, x + penWidthLeft / 2, y + height)
If (penWidthRight Mod 2 > 0) Then align = 1
g.DrawLine(selectionRightPen, x + width - align - penWidthRight / 2, y, x + width - align - penWidthRight / 2,
y + height)
selectionLeftPen.Dispose()
selectionRightPen.Dispose()
End If
End Sub
End Class
Private Sub SetSelectionRenderer(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem78.Click
Dim sv As FarPoint.Win.Spread.SpreadView = FpSpread1.GetRootWorkbook
sv.SelectionRenderer = New CustomBorder()
End Sub
End Class