You can line up text box parts of several combo/edit boxes vertically on a Ribbon group using the RibbonComboBox.RibbonComboBox.GapBeforeTextArea and RibbonTextBox. GapBeforeTextArea properties. This property specifies the gap (in pixels) between the label and text box parts of the element. The maximum allowable value for this property has been set to 80.
Complete the following steps:
Optionally, you can add the Ribbon combo/edit boxes to the Ribbon group and specify the gap between the label and text box parts of the combo/edit box elements using code.
Add the following code to your project:
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 ' add a RibbonComboBox and RibbonTextBox items ' to the Ribbon group Dim ComboBox1 As RibbonComboBox = New RibbonComboBox() Dim EditBox1 As RibbonTextBox = New RibbonTextBox() RibbonGroup1.Items.Add(ComboBox1) RibbonGroup1.Items.Add(EditBox1) ' add a label ComboBox1.Label = "Favorites:" EditBox1.Label = "Find:" ' specify the gap between the "label" and "text box" ' parts of the combo/edit box elements ComboBox1.GapBeforeTextArea = 3 EditBox1.GapBeforeTextArea = 28 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, System.EventArgs e) { // add a RibbonComboBox and RibbonTextBox items // to the Ribbon group RibbonComboBox ComboBox1 = new RibbonComboBox(); RibbonTextBox EditBox1 = new RibbonTextBox(); ribbonGroup1.Items.Add(ComboBox1); ribbonGroup1.Items.Add(EditBox1); // add a label ComboBox1.Label = "Favorites:"; EditBox1.Label = "Find:"; // specify the gap between the "label" and "text box" // parts of the combo/edit box elements ComboBox1.GapBeforeTextArea = 3; EditBox1.GapBeforeTextArea = 28; } |
With the GapBeforeTextArea property set for the Ribbon combo box and edit box items, the text box parts line up vertically on the Ribbon group: