src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/UI/ColumnHeader.cs
/// <summary>
///     Attempt to set the column to the given size. If this is a fixed width
///     adjustable column then the adjustment is straightforward and always gives
///     the full size. If this is a proportional column, then an attempt is made
///     to set the percentage high enough to get the full width. The percentage
///     is taken proportionally from all other proportional columns.
/// </summary>
/// <param name="control">The control we're adjusting, pass in to allow calculations to be performed only when needed</param>
/// <param name="displayColumn">The column to adjust</param>
/// <param name="requestedWidth">The width to set it to</param>
/// <returns>True if a column width changed</returns>
Attempt to set the column to the given size. If this is a fixed width
adjustable column then the adjustment is straightforward and always gives
the full size. If this is a proportional column, then an attempt is made
to set the percentage high enough to get the full width. The percentage
is taken proportionally from all other proportional columns.
Attempt to set the column to the given size . If this is a fixed width adjustable column then the adjustment is straightforward and always gives the full size . If this is a proportional column then an attempt is made to set the percentage high enough to get the full width . The percentage is taken proportionally from all other proportional columns .
public bool RequestSetColumnWidth(VirtualTreeControl control, int displayColumn, int requestedWidth)
            {
                if (myHeaders == null)
                {
                    return false;
                }
                var retVal = false;
                var header = myHeaders[displayColumn];
                if (AllowColumnAdjustment(displayColumn)
                    && header.IsColumnAdjustable)
                {
                    if (header.Percentage == 0f)
                    {
                        if (requestedWidth < VirtualTreeColumnHeader.MinimumPixelWidth)
                        {
                            requestedWidth = VirtualTreeColumnHeader.MinimumPixelWidth;
                        }
                        var widthDelta = requestedWidth - header.Width;
                        if (widthDelta != 0)
                        {
                            myTotalFixedWidth += widthDelta;
                            myHeaders[displayColumn].SetWidth(requestedWidth);
                            Recalculate();
                            retVal = true;
                        }
                    }
                    else
                    {
                        var itemRect = new Rectangle(0, 0, 0, 0);
                        control.LimitRectToColumn(displayColumn, ref itemRect, false, -1, true);
                        BeginColumnAdjustment(displayColumn, itemRect.Left, 0);
                        requestedWidth = LimitColumnAdjustment(itemRect.Left + requestedWidth);
                        if (control.LeftScrollBar
                            && !control.HasVerticalScrollBar)
                        {
                            requestedWidth -= SystemInformation.VerticalScrollBarWidth;
                        }
                        retVal = EndColumnAdjustment(control.FullPercentageHeaderWidth, requestedWidth);
                    }
                    if (retVal)
                    {
                        control.SetStateFlag(VTCStateFlags.FullColumnHeadersDirty, true);
                    }
                }
                return retVal;
            }
public bool RequestSetColumnWidth ( VirtualTreeControl control , int displayColumn , int requestedWidth ) { if ( myHeaders == null ) { return false ; } var retVal = false ; var header = myHeaders [ displayColumn ] ; if ( AllowColumnAdjustment ( displayColumn ) && header . IsColumnAdjustable ) { if ( header . Percentage == 0f ) { if ( requestedWidth < VirtualTreeColumnHeader . MinimumPixelWidth ) { requestedWidth = VirtualTreeColumnHeader . MinimumPixelWidth ; } var widthDelta = requestedWidth - header . Width ; if ( widthDelta != 0 ) { myTotalFixedWidth += widthDelta ; myHeaders [ displayColumn ] . SetWidth ( requestedWidth ) ; Recalculate ( ) ; retVal = true ; } } else { var itemRect = new Rectangle ( 0 , 0 , 0 , 0 ) ; control . LimitRectToColumn ( displayColumn , ref itemRect , false , - 1 , true ) ; BeginColumnAdjustment ( displayColumn , itemRect . Left , 0 ) ; requestedWidth = LimitColumnAdjustment ( itemRect . Left + requestedWidth ) ; if ( control . LeftScrollBar && ! control . HasVerticalScrollBar ) { requestedWidth -= SystemInformation . VerticalScrollBarWidth ; } retVal = EndColumnAdjustment ( control . FullPercentageHeaderWidth , requestedWidth ) ; } if ( retVal ) { control . SetStateFlag ( VTCStateFlags . FullColumnHeadersDirty , true ) ; } } return retVal ; }
Attempt to set the column to the given size.
Attempt to set the column to the given size .
True if a column width changed
True if a column width changed
control
VirtualTreeControl
The control we're adjusting, pass in to allow calculations to be performed only when needed
The control we ' re adjusting pass in to allow calculations to be performed only when needed
displayColumn
int
The column to adjust
The column to adjust
requestedWidth
int
The width to set it to
The width to set it to