All bars within SandBar can host any arbitrary control within an item. You can therefore achieve common tasks such as hosting a combobox in a toolbar or a progressbar in a statusbar.
Although an item that hosts a combobox is packaged with the SandBar library, if you need to host any other kind of control you will need to create your own item that hosts it. This is very easy to do.
You must derive from the ControlContainerItem class. The minimum you have to do is create a constructor which calls the base constructor passing a new instance of whatever control you wish to host. You can then use the ContainedControl property to gain access to the control created. SandBar will take care of hosting and positioning the control in the toolbar.
For instance, to create an item that hosts a checkbox, you would do the following:
[code]
public class CheckBoxItem : TD.SandBar.ControlContainerItem
{
public CheckBoxItem() : base(new System.Windows.Forms.CheckBox())
{
// Make checkbox background transparent so any gradients etc show through
ContainedControl.BackColor = System.Drawing.Color.Transparent;
// Set default text
ContainedControl.Text = "CheckBox";
}
}
[/code]