Resizing Combo Dropdown Columns

using Infragistics.Win.UltraWinGrid;

public class Script
{

// Add Custom Module Level Variables Here **
private Erp.UI.Controls.Combos.JobMtlSearchCombo cboPOLnMtl;

public void InitializeCustomCode()
{
// Begin Wizard Added Custom Method Calls

  cboPOLnMtl= (Erp.UI.Controls.Combos.JobMtlSearchCombo)csm.GetNativeControlReference("Your_Control_GUID_Here");
  this.cboPOLnMtl.BeforeDropDown += new System.ComponentModel.CancelEventHandler(this.cboPOLnMtl_BeforeDropDown);
  this.cboPOLnMtl.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.cboPOLnMtl_InitializeLayout);

// End Wizard Added Custom Method Calls
}

public void DestroyCustomCode()
{
// Begin Custom Code Disposal

  this.cboPOLnMtl.BeforeDropDown -= new System.ComponentModel.CancelEventHandler(this.cboPOLnMtl_BeforeDropDown);
  this.cboPOLnMtl.InitializeLayout -= new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.cboPOLnMtl_InitializeLayout);
  cboPOLnMtl = null;

// End Custom Code Disposal
}

// Following allows column sizing
private void cboPOLnMtl_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs args)
  {
  args.Layout.Override.AllowColSizing = AllowColSizing.Free;
  args.Layout.PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand,true);
  }

// Following sets drop down and/or column widths.
private void cboPOLnMtl_BeforeDropDown(object sender, System.ComponentModel.CancelEventArgs args)
{
  //cboPOLnMtl.DropDownWidth = 200;
  cboPOLnMtl.DisplayLayout.Bands[0].Columns[0].Width = 30;
  cboPOLnMtl.DisplayLayout.Bands[0].Columns[1].Width = 80;
}

}

猜你喜欢

转载自blog.csdn.net/huanglin529/article/details/72882572