using System;
using System.Windows.Forms;
using Infragistics.Win.UltraWinGrid;
private UltraGrid ultraGrid;
private TextBox companyNameTextBox;
private TextBox contactNameTextBox;
private TextBox contactTitleTextBox;
private TextBox addressTextBox;
private TextBox cityTextBox;
private TextBox regionTextBox;
private TextBox postalCodeTextBox;
private TextBox countryTextBox;
...
#region 폼 로드시 처리하기 - Form_Load(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Load(object sender, EventArgs e)
{
this.companyNameTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "CompanyName" );
this.contactNameTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "ContactName" );
this.contactTitleTextBox.DataBindings.Add("Text", this.ultraGrid.DataSource, "ContactTitle");
this.addressTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Address" );
this.cityTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "City" );
this.regionTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Region" );
this.postalCodeTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "PostalCode" );
this.countryTextBox.DataBindings.Add ("Text", this.ultraGrid.DataSource, "Country" );
}
#endregion
#region UltraGrid 레이아웃 초기화 하기 - ultraGrid_InitializeLayout(sender, e)
/// <summary>
/// UltraGrid 레이아웃 초기화 하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
foreach(UltraGridColumn ultraGridColumn in e.Layout.Bands[0].Columns)
{
switch(ultraGridColumn.Key)
{
case "CustomerID" : ultraGridColumn.CellActivation = Activation.NoEdit; break;
default : ultraGridColumn.Hidden = true; break;
}
}
e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
e.Layout.Override.SelectTypeCell = SelectType.None;
e.Layout.Override.SelectTypeCol = SelectType.None;
e.Layout.Override.SelectTypeRow = SelectType.None;
}
#endregion