Spread Windows Forms 13.0 Product Documentation
Spread Windows Forms 13.0 Product Documentation / Developer's Guide / Customizing the Sheet Appearance / Customizing the Appearance of the Overall Component / Using XP Themes with the Component
In This Topic
    Using XP Themes with the Component
    In This Topic

    You can set support for XP themes for the cells and graphical elements in the Spread component. The VisualStyles property for the Spread component causes the cells to have the appearance of the XP theme. You can create a manifest file so that the scroll bars have a theme appearance.

    By default the VisualStyles property is set to Auto, so the graphical cell types paint the way the theme is set to paint (for example the button is themed so you cannot set a background color with the BackColor property). You either need to turn off VisualStyles for the Spread component or create a custom cell type where you override the PaintCell and GetEditorControl methods and then set the VisualStyles property of the Appearance object to off. A third alternative is to leave it "on" for the Spread component but turn it "off" for the individual control (such as the FpProgress control for the progress indicator cell).

    Applying a sheet skin causes the VisualStyles property to be set to false.

    If you are on Windows XP, then you need to add the following line of code to turn off the XP themes in the Spread.

    fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.Off

    Setting the VisualStyles property of the Spread to Off should return the look of the Spread to the classic look.

    Buttons are not displayed as expected if you have changed the SelectionStyle and have VisualStyles on. The problem is that when VisualStyles are on certain cell types ignore certain settings, such as the button ignoring the setting of the ButtonColor property. You would need to take that into account and possibly set the SelectionForeColor, for example, to something different. The SelectionColors setting for SelectionStyle is an older style and mixing it with XP themes is not recommended.

    The VisualStyles property is used on controls that Spread renders such as the button in the ButtonCellType. The scroll bars are child controls rendered by Visual Studio. To have them render with XP themes, you would need to set up a manifest for your application.

    Using the Properties Window

    1. Select the Spread component.
    2. In the Properties window, select the VisualStyles property, and choose an option from the drop-down list.

    Using Code

    Add a line of code that allows the theme support by setting the VisualStyles property for the Spread component.

    Example

    This example sets the VisualStyles property to on to allow XP themes.

    C#
    Copy Code
    fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.On;
    VB
    Copy Code
    fpSpread1.VisualStyles = FarPoint.Win.VisualStyles.On

    Using the Spread Designer

    1. Select Sheet from the drop-down list located on the top right side of the Designer.
    2. From the Appearance section, select an option for the VisualStyles property.
    3. From the File menu, select Save and Exit to save the changes.
    See Also