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:
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() + "%"; } |
Run the application, click and drag the track bar control. Notice that the progress bar and button control values change simultaneously: