There are many types of controls, most of which come with their own captions. Some controls, like combo boxes and date fields, do not. The label control gives you a way to accomplish this.

Keeping Label Next to Control

The label control is just a plain control. It has no awareness of the controls around it, so the ribbon will attempt to organize it just like any other control. If you want the label to appear next to a particular control, you need to make sure to do two things: set the group's GroupControls attribute and the Label's BeginGroup attribute. Setting the group's GroupControls attribute to true tells the ribbon that control in that group need to line up side-by-side. Setting the Label's BeginGroup attribute to true tells the ribbon that the label begins a new group. Here's an example:

<Group Key="PARAGRAPH" Caption="Paragraph" OptionButton="true" GroupControls="true" Tooltip="Displays the Paragraph window.">
   <CheckBox Key="CHB_TEST" Caption="Check Me" Shortcut="Ctrl+H" Tooltip="This is a check box." />
   <Label Key="STA_TEST" Caption="My Date Field" Height="22" BeginGroup="true" />
   <DateField Key="DTF_TEST" Width="180" Height="22" Tooltip="This is a date field." />
</Group>
  • No labels