Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Headers / Customizing the Sheet Corner Appearance / Drawing (Rendering) Style
In This Topic
    Drawing (Rendering) Style
    In This Topic

    You can customize the corner renderer, which draws the sheet corner.

    There are two pre-defined corner renderers in Spread.

    The default renderer draws the sheet corner with or without Windows XP style depending on the setting of the system.

    The enhanced corner renderer always draws the sheet corner with an appearance similar to Microsoft Excel 2007.

    Example

    This example lists the methods that are used to create a custom corner renderer.

    C#
    Copy Code
    public class MyCornerRenderer : IRenderer {
    /// <summary>
    /// Gets the preferred (maximum needed) size of the cell for the renderer control.
    /// </summary>
    /// <param name="g">Graphics device interface for painting the cell</param>
    /// <param name="size">Preferred or maximum needed size</param>
    /// <param name="appearance">Appearance settings of the renderer control</param>
    /// <param name="value">Object containing the name of the renderer control</param>
    /// <param name="zoomFactor">Numeric value for zoom factor for scaling the display of the renderer control</param>
    /// <returns></returns>
    public Size GetPreferredSize(Graphics g, Size size, Appearance appearance, object value, float zoomFactor)
    {
    ///Your Code add here
    }
    /// <summary>
    /// Paints the corner cell when not in edit mode to the specified graphics interface
    /// with the specified appearance settings.
    /// </summary>
    /// <param name="g">Graphics device interface for painting the corner cell</param>
    /// <param name="r">Location and size of a rectangular region for painting the corner cell</param>
    /// <param name="appearance">Appearance settings of the corner cell</param>
    /// <param name="value">Object containing the name of the renderer control of the corner cell</param>
    /// <param name="isSelected">Whether the corner cell is selected</param>
    /// <param name="isLocked">Whether the corner cell is locked</param>
    /// <param name="zoomFactor">Numeric value for scaling the display of the corner cell</param>
    public virtual void PaintCell(Graphics g, Rectangle r, Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)
    {
    ///Your Code add here
    }
    /// <summary>
    /// Paints the corner cell.
    /// </summary>
    /// <param name="g">Graphics device interface for painting the corner cell</param>
    /// <param name="r">Location and size of a rectangular region for painting the corner cell</param>
    /// <param name="backColor">Background color of the corner cell</param>
    /// <param name="foreColor">Foreground color of the corner cell</param>
    /// <param name="f">Font</param>
    /// <param name="horizontalAlignment">Horizontal alignment of corner cell content</param>
    /// <param name="verticalAlignment">Vertical alignment of the corner cell content</param>
    /// <param name="s">String to paint</param>
    /// <param name="textOrientation">Orientation of the text</param>
    /// <param name="wordWrap">Whether wrap words to multiple lines</param>
    /// <param name="hotkeyPrefix">Whether to show hotkey effect</param>
    /// <param name="stringTrim">String trimming mode</param>
    /// <param name="visualStyles">Visual styles</param>
    /// <param name="mouseOver">Whether the mouse is over the corner cell</param>
    /// <param name="rightToLeft">Whether to display right to left</param>
    /// <param name="zoomFactor">Numeric value for scaling the display of the corner cell</param>
    public virtual void PaintCorner(Graphics g, Rectangle r, Color backColor, Color foreColor, Font f, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, string s, TextOrientation textOrientation, bool wordWrap, HotkeyPrefix hotkeyPrefix, StringTrimming stringTrim, VisualStyles visualStyles, bool mouseOver, bool rightToLeft, float zoomFactor)
    {
    ///Your Code add here
    }
    /// <summary>
    /// Determines whether this cell can overflow into an adjacent cell.
    /// </summary>
    /// <returns></returns>
    public bool CanOverflow()
    {
    ///Your Code add here
    }
    /// <summary>
    /// Determines whether adjacent cells can overflow into this cell.
    /// </summary>
    /// <returns></returns>
    public bool CanBeOverflown()
    {
    ///Your Code add here
    }
    }
    // Assign new corner render to drawing sheet corner:
    fpSpread1.ActiveSheet.SheetCornerStyle.Renderer = new MyCornerRenderer();
    
    See Also