Active Query Builder 2 .NET Edition reference
GetDiagramObjectWidth Event
Example 



Called to calculate width of the newly added datasource.
Syntax
'Declaration
 
Public Event GetDiagramObjectWidth As GetDiagramObjectWidthEventHandler
'Usage
 
Dim instance As QueryBuilder
Dim handler As GetDiagramObjectWidthEventHandler
 
AddHandler instance.GetDiagramObjectWidth, handler
public event GetDiagramObjectWidthEventHandler GetDiagramObjectWidth
public: __event GetDiagramObjectWidthEventHandler* GetDiagramObjectWidth
Example
Sets the DataSource control width according to width of it's fields.
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;
}
See Also

Reference

QueryBuilder Class
QueryBuilder Members

 

 


© Copyright 2005-2012 ActiveDBSoft. All rights reserved.

Send Feedback