Spread Windows Forms 12.0 Product Documentation
PaintCell(Graphics,Rectangle,Appearance,Object,Boolean,Boolean,Single) Method
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > CornerRenderer Class > PaintCell Method : PaintCell(Graphics,Rectangle,Appearance,Object,Boolean,Boolean,Single) Method
Graphics device interface for painting the corner cell
Location and size of a rectangular region for painting the corner cell
Appearance settings of the corner cell
Object that contains the name of the renderer control of the corner cell
Whether the corner cell is selected
Whether the corner cell is locked
Numeric value for scaling the display of the corner cell
Paints the corner cell when not in edit mode to the specified graphics interface with the specified appearance settings.
Syntax
'Declaration
 
Public Overloads Overridable Sub PaintCell( _
   ByVal g As Graphics, _
   ByVal r As Rectangle, _
   ByVal appearance As Appearance, _
   ByVal value As Object, _
   ByVal isSelected As Boolean, _
   ByVal isLocked As Boolean, _
   ByVal zoomFactor As Single _
) 
'Usage
 
Dim instance As CornerRenderer
Dim g As Graphics
Dim r As Rectangle
Dim appearance As Appearance
Dim value As Object
Dim isSelected As Boolean
Dim isLocked As Boolean
Dim zoomFactor As Single
 
instance.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor)
public virtual void PaintCell( 
   Graphics g,
   Rectangle r,
   Appearance appearance,
   object value,
   bool isSelected,
   bool isLocked,
   float zoomFactor
)

Parameters

g
Graphics device interface for painting the corner cell
r
Location and size of a rectangular region for painting the corner cell
appearance
Appearance settings of the corner cell
value
Object that contains the name of the renderer control of the corner cell
isSelected
Whether the corner cell is selected
isLocked
Whether the corner cell is locked
zoomFactor
Numeric value for scaling the display of the corner cell
Example
This example creates a custom corner renderer.
public class MyCornerRenderer : FarPoint.Win.Spread.CellType.IRenderer
        {
public bool CanOverflow() { return true; }
            public bool CanBeOverflown() { return true; }
            public virtual void PaintCell(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appear, object value, bool issel, bool isl, float zoom) {
                g.FillRectangle(Brushes.Green, 0, 0, 30, 30);                
            }
            public Size GetPreferredSize(Graphics g, Size size, FarPoint.Win.Spread.Appearance appear, object value, float zoomFactor)
            {
                size = new Size(10, 10);
                return size;
            }            
        }

        private void Form1_Load(object sender, EventArgs e)
        {      
            fpSpread1.ActiveSheet.SheetCornerStyle.Renderer = new MyCornerRenderer();       
        }
Public Class MyCornerRenderer
        Implements FarPoint.Win.Spread.CellType.IRenderer

        Public Sub PaintCell(g As Graphics, r As Rectangle, appearance As FarPoint.Win.Spread.Appearance, value As Object, isSelected As Boolean, isLocked As Boolean, zoomFactor As Single) Implements FarPoint.Win.Spread.CellType.IRenderer.PaintCell
            g.FillRectangle(Brushes.Green, 0, 0, 30, 30)
        End Sub

        Public Function CanBeOverflown() As Boolean Implements FarPoint.Win.Spread.CellType.IRenderer.CanBeOverflown
            Return True
        End Function

        Public Function CanOverflow() As Boolean Implements FarPoint.Win.Spread.CellType.IRenderer.CanOverflow
            Return True
        End Function

        Public Function GetPreferredSize(g As Graphics, size As Size, appear As FarPoint.Win.Spread.Appearance, value As Object, zoomFactor As Single) As Size Implements FarPoint.Win.Spread.CellType.IRenderer.GetPreferredSize
            size = New Size(10, 10)
            Return size
        End Function
    End Class

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        fpSpread1.ActiveSheet.SheetCornerStyle.Renderer = New MyCornerRenderer()
    End Sub
See Also

Reference

CornerRenderer Class
CornerRenderer Members
Overload List