PowerTools SPREAD for Windows Forms 10.0J
SelectionRenderer プロパティ (SpreadView)


ビュー内の選択範囲を描画するレンダラを取得または設定します。
構文
'Declaration
 
Public Property SelectionRenderer As ISelectionRenderer
'使用法
 
Dim instance As SpreadView
Dim value As ISelectionRenderer
 
instance.SelectionRenderer = value
 
value = instance.SelectionRenderer
public ISelectionRenderer SelectionRenderer {get; set;}

プロパティ値

レンダラを指定するISelectionRendererオブジェクト
次のサンプルコードは、SelectionRendererプロパティを設定します。
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
参照

SpreadView クラス
SpreadView メンバ

開発者ガイド

選択領域の外観

 

 


© 2004-2017, GrapeCity inc. All rights reserved.