private void queryBuilder1_GetDataSourceWidth(QueryBuilder queryBuilder, DataSource datasource, ref int width)
{
DataSourceControl dsControl = (DataSourceControl) datasource.DSControl.GetControl();
DataSourceFieldList flControl = dsControl.FieldList;
Font font = queryBuilder.DiagramObjectFont;
int maxWidth = 0;
using (Graphics g = CreateGraphics())
{
foreach (TextAndObject item in flControl.Items)
{
maxWidth = (int) Math.Max(g.MeasureString(item.ToString(), Font).Width, maxWidth);
}
}
int extra = 45; // width of checkbox, key mark column and borders
width = maxWidth + extra;
}