Caption/Label for BarComboBox

Bars for Windows Forms Forum

Posted 15 years ago by Justin Bozonier
Version: 2.0.0107
I'm using the following code to add a combo box to my toolbar. I want to show the text of the combo box next to it. How do I do that?

var mainScalingBarComboBoxCommand = new BarComboBoxCommand("Main", "Scaling", "Scaling", -1);
mainScalingBarComboBoxCommand.Tag = "Scaling";
mainScalingBarComboBoxCommand.Text = "Scaling";
var mainScalingBarComboBoxLink = new BarComboBoxLink(mainScalingBarComboBoxCommand);
mainScalingBarComboBoxLink.Image = Properties.Resources.goto_16;
mainScalingBarComboBoxLink.DisplayStyle = BarCommandLinkDisplayStyle.ImageAndText;
mainScalingBarComboBoxLink.DefaultText = "Scaling";
mainScalingBarComboBoxLink.Text = "Scaling";
My current "solution" is to create a disabled button next to it as a label. The problem is that this button's text is vertically off-center.

var labelButtonCommand = new BarButtonCommand("Main", "ScaleLabel", "Scale: ", -1);
var labelButtonLink = labelButtonCommand.CreateCommandLink();// new BarButtonLink(labelButtonCommand);
labelButtonLink.DisplayStyle = BarCommandLinkDisplayStyle.TextOnly;
labelButtonCommand.Tag = "Scale";
labelButtonCommand.Text = "Scale: ";
labelButtonCommand.Enabled = false;
Thanks in advance for your help!

Comments (1)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Maybe try using a BarLabelLink and related command instead. That is intended to be a static label and should look better than a disabled button would.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.