The Spread for Windows Forms spreadsheet control can be combined with other components, such as a Ribbon control in order to provide design functionality and other control to the user. In this example, you will learn how to add a Ribbon control to a project and connect it to a Spread component in a Windows Forms application. If you want to follow along, make sure to download the CodePlex open-source ribbon library from here: CodePlex Ribbon In addition, the DLL for this particular Spread Ribbon Control can be found here: Spread Ribbon Control
Create a new C# Windows Forms application in Visual Studio 2015. Once you have done so, click and drag the FpSpread component from the Toolbox onto a form in your application: The form with a Spread instance on it. When you click on the FpSpread component in your form, switch the “Dock” property to “Bottom”: The docking option in the properties window. Next, add the reference for the open source Ribbon to the project by right-clicking References in the Solution Explorer and clicking Add Reference…. Browse to the path where you downloaded the CodePlex Ribbon and choose the “System.Windows.Forms.Ribbon35.dll” file. The References for the Project in the Solution Explorer Once the correct references are added and the FpSpread component is on the form, you are now ready to add the Ribbon control.
In order to easily add the Ribbon control, it has to be added to the Toolbox in Visual Studio. With the Toolbox open, right click the open space below the items and click Choose Items… Once the Choose Toolbox Items window is open, click Browse… The Choose Toolbox Items window. Navigate to the path where you saved the SpreadRibbonControlLibrary.zip file. Make sure to extract it first, and then choose the SpreadRibbonControlLibrary.dll file. Once you are brought back to the Choose Toolbox Items window, click OK to add it to the Toolbox. The new control should now show as SpreadRibbon in the Toolbox. To add it to the form, simply click and drag it from the Toolbox to the form. The form with the added Spread Ribbon Control.
Once the Spread Ribbon Control has been added to the form, it can be connected to a Spread component on that form (Note: the Ribbon can only be connected to one instance of the Spread component at a time). There are Smart Tags to make this process easy, which include specifying the Spread instance and docking it in the form. To open the Smart Tags for the control, select the instance of the Ribbon Control in the form and click on the arrow at the top right of the control: The Smart Tags for the Spread Ribbon Control. To connect the ribbon to the FpSpread control, click the Spread Instance drop-down and select the name of the FpSpread control. To dock the control to the top of the form, click on Dock in parent container. Save the changes, and then Build and Run the project. If done correctly, the form should open up with the Spread control as well as the Ribbon control. You should be able to make changes to the FpSpread component from the ribbon toolbar, and see the properties of the cells reflected in the Ribbon. The completed form.