C1Ribbon (Classic) Task-Based Help / Adding Status Bar Items
Adding Status Bar Items

Before you begin this task, double-click the C1StatusBar icon in the Visual Studio Toolbox to add the C1StatusBar control to the Ribbon Form. The status bar docks at the bottom of the Ribbon Form. Note that you can add items to the status bar using the smart designer, Collection Editor, or Code Editor. This topic shows how to add status bar items using the Collection Editors.

Complete the following steps:

  1. Click the C1StatusBar control to activate it.
  2. In C1StatusBars Properties window, click on the (Collection) next to the LeftPaneItems property, then click the ellipsis button.
    The C1StatusBar LeftPaneItems Collection Editor appears.
  3. Click the Add drop-down button and select Ribbon ProgressBar from the list.
  4. With the progress bar selected in the Members list, set the RibbonProgressBar.Value property to 30.
  5. Click OK to close the collection editor.
  6. In C1StatusBars Properties window, click on the (Collection) next to the RightPaneItems property, then click the ellipsis button.
    The C1StatusBar RightPaneItems Collection Editor appears.
  7. Click the Add drop-down button and select RibbonButton and RibbonTrackBar to add the items to the Members list.
  8. With the button selected in the Members list, set the following properties in the Properties window:
  9. Click OK to close the collection editor.
  10. In C1StatusBars Properties window, set the C1StatusBar.RightPaneWidth property to 150.
  11. In the Code Editor, add the following code to enable the items on the left and right panel:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    ' type the Imports directive for the namespace
    Imports C1.Win.C1Ribbon
     
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        RibbonTrackBar1.SmallChange = 1
        RibbonTrackBar1.LargeChange = 5
        RibbonTrackBar1.Minimum = 0
        RibbonTrackBar1.Maximum = 100
        RibbonTrackBar1.Value = 30
        AddHandler RibbonTrackBar1.Scroll, AddressOf RibbonTrackBar1_Scroll
    End Sub
     
    Sub RibbonTrackBar1_Scroll(ByVal sender As Object, ByVal e As EventArgs)
        Dim val As Integer = RibbonTrackBar1.Value
        RibbonProgressBar1.Value = val
        RibbonButton1.Text = val.ToString + "%"
    End Sub
    

    To write code in C#

    C#
    Copy Code
    // type the using directive for the namespace
    using C1.Win.C1Ribbon;
     
    private void Form1_Load(object sender, EventArgs e)
    { 
        ribbonTrackBar1.SmallChange = 1;
        ribbonTrackBar1.LargeChange = 5;
        ribbonTrackBar1.Minimum = 0;
        ribbonTrackBar1.Maximum = 100;
        ribbonTrackBar1.Value = 30;
        ribbonTrackBar1.Scroll += new EventHandler(ribbonTrackBar1_Scroll);
               
    }
    void ribbonTrackBar1_Scroll(object sender, EventArgs e)
    {
        int val = _trackbar.Value;
        ribbonProgressBar1.Value = val;
        ribbonButton1.Text = val.ToString() + "%";
    }
    

This topic illustrates the following:

Run the application, click and drag the track bar control. Notice that the progress bar and button control values change simultaneously: