参考代码
Dim w As Double = basemainform.width - 60
ConfigBar.Items.clear
Dim lb1 As new RibbonMenu.Label("Space")
Dim gc As Graphics = BaseMainform.CreateGraphics()
For i As Integer = 1 To 1000
Dim str = "".PadLeft(i, "a")
Dim size As SizeF = gc.MeasureString(str, basemainform.font)
If size.Width > w Then
lb1.Text = new String(" ", i)
ConfigBar.Items.Add(lb1)
Exit For
End If
Next