How to get the width of BarItems in WinForms XPToolBar?
Width of BarItems
In WinForms Toolbar, BarItem type of controls are used as its Child controls and its size will be calculated based on the defined font. The following code demonstrates the same.
C#
//code used to measure the font width of XPToolBar
MessageBox.Show("Width Of BarItem2 is " +TextRenderer.MeasureText(this.barItem2.Text + " ", this.xpToolBar1.Font).Width.ToString());
VB
'code used to measure the font width of XPToolBar
MessageBox.Show("Width Of BarItem2 is " & TextRenderer.MeasureText(Me.barItem2.Text & " ", Me.xpToolBar1.Font).Width.ToString())Screenshot

Samples:
C#: XPToolBarExample
VB: XPToolBarExample