BrightIdeasSoftware.ObjectListView.AutoResizeColumns C# (CSharp) Method

AutoResizeColumns() public method

Resize the columns to the maximum of the header width and the data.
public AutoResizeColumns ( ) : void
return void
        public void AutoResizeColumns()
        {
            foreach (OLVColumn c in this.Columns)
            {
                c.Width = -2;
            }
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Post process columns after creating them and adding them to the AllColumns collection.
 /// </summary>
 /// <param name="olv"></param>
 public virtual void PostCreateColumns(ObjectListView olv)
 {
     if (olv.AllColumns.Exists(delegate(OLVColumn x) { return x.CheckBoxes; }))
         olv.UseSubItemCheckBoxes = true;
     if (olv.AllColumns.Exists(delegate(OLVColumn x) { return x.Index > 0 && (x.ImageGetter != null || !String.IsNullOrEmpty(x.ImageAspectName)); }))
         olv.ShowImagesOnSubItems = true;
     olv.RebuildColumns();
     olv.AutoResizeColumns();
 }
ObjectListView