첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
본 블로그는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 블로그 콘텐츠 향상을 위해 쓰여집니다.

728x90
반응형

using System;
using System.Drawing;

using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win.UltraWinGrid;

private UltraGrid ultraGrid;

private UltraCheckEditor useOSThemeCheckBox;

...

#region UltraGrid 행 초기화 하기 - ultraGrid_InitializeRow(sender, e)

/// <summary>
/// UltraGrid 행 초기화 하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void ultraGrid_InitializeRow(object sender, InitializeRowEventArgs e)
{
    e.Row.ExpandAll();
}

#endregion

#region Use OS Theme 체크 박스 체크 변경시 처리하기 - useOSThemeCheckBox_CheckedChanged(sender, e)

/// <summary>
/// Use OS Theme 체크 박스 체크 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void useOSThemeCheckBox_CheckedChanged(object sender, EventArgs e)
{
    if(this.useOSThemeCheckBox.Checked == true)
    {
        this.ultraGrid.UseOsThemes = DefaultableBoolean.True;
    }
    else
    {
        this.ultraGrid.UseOsThemes = DefaultableBoolean.False;
    }
}

#endregion

#region Grid Header 버튼 클릭시 처리하기 - gridHeaderButton_Click(sender, e)

/// <summary>
/// Grid Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void gridHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.UseOsThemes = DefaultableBoolean.False;

    this.ultraGrid.Text = "Test Grid";

    this.ultraGrid.DisplayLayout.CaptionAppearance.BackColor = Color.LightYellow;
}

#endregion

#region Parent Band Header 버튼 클릭시 처리하기 - parentBandHeaderButton_Click(sender, e)

/// <summary>
/// Parent Band Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void parentBandHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.DisplayLayout.Bands[0].HeaderVisible               = true;
    this.ultraGrid.DisplayLayout.Bands[0].Header.Caption              = "Band 0 Header";
    this.ultraGrid.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightYellow;
}

#endregion

#region Child Band Header 버튼 클릭시 처리하기 - ChildBandHeaderButton_Click(sender, e)

/// <summary>
/// Child Band Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void ChildBandHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.DisplayLayout.Bands[1].HeaderVisible               = true;
    this.ultraGrid.DisplayLayout.Bands[1].Header.Caption              = "Band 1 Header";
    this.ultraGrid.DisplayLayout.Bands[1].Header.Appearance.BackColor = Color.LightYellow;
}

#endregion

#region Parent Band Column Header 버튼 클릭시 처리하기 - parentBandColumnHeaderButton_Click(sender, e)

/// <summary>
/// Parent Band Column Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void parentBandColumnHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;
    
    this.ultraGrid.DisplayLayout.Bands[0].Override.HeaderAppearance.BackColor = Color.LightYellow;
}

#endregion

#region Child Band Column Header 버튼 클릭시 처리하기 - childBandColumnHeaderButton_Click(sender, e)

/// <summary>
/// Child Band Column Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void childBandColumnHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.DisplayLayout.Bands[1].Override.HeaderAppearance.BackColor = Color.LightYellow;
}

#endregion

#region Order ID Column Header 버튼 클릭시 처리하기 - orderIDColumnHeaderButton_Click(sender, e)

/// <summary>
/// Order ID Column Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void orderIDColumnHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderID"].Header.Caption              = "Order ID";
    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderID"].Header.Appearance.BackColor = Color.LightCoral;
}

#endregion

#region Card View Header 버튼 클릭시 처리하기 - cardViewHeaderButton_Click(sender, e)

/// <summary>
/// Card View Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void cardViewHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    this.ultraGrid.DisplayLayout.Bands[1].CardView                                 = true;
    this.ultraGrid.DisplayLayout.Bands[1].CardSettings.CaptionField                = "OrderID";
    this.ultraGrid.DisplayLayout.Bands[1].CardSettings.ShowCaption                 = true;
    this.ultraGrid.DisplayLayout.Bands[1].Override.CardCaptionAppearance.BackColor = Color.Blue;
    this.ultraGrid.DisplayLayout.Bands[1].Override.CardCaptionAppearance.ForeColor = Color.White;
}

#endregion

#region Group Header 버튼 클릭시 처리하기 - groupHeaderButton_Click(sender, e)

/// <summary>
/// Group Header 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void groupHeaderButton_Click(object sender, EventArgs e)
{
    this.useOSThemeCheckBox.Checked = false;

    if(this.ultraGrid.DisplayLayout.Bands[1].Groups.Exists("Orders") == true)
    {
        return;
    }

    this.ultraGrid.DisplayLayout.Bands[1].Groups.Add("Orders");

    this.ultraGrid.DisplayLayout.Bands[1].LevelCount = 2;

    this.ultraGrid.DisplayLayout.Bands[1].Columns["CustomerID"].Group = this.ultraGrid.DisplayLayout.Bands[1].Groups["Orders"];
    this.ultraGrid.DisplayLayout.Bands[1].Columns["CustomerID"].Level = 0;

    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderID"].Group = this.ultraGrid.DisplayLayout.Bands[1].Groups["Orders"];
    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderID"].Level = 0;
    
    this.ultraGrid.DisplayLayout.Bands[1].Columns["EmployeeID"].Group = this.ultraGrid.DisplayLayout.Bands[1].Groups["Orders"];
    this.ultraGrid.DisplayLayout.Bands[1].Columns["EmployeeID"].Level = 1;
    
    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderDate"].Group = this.ultraGrid.DisplayLayout.Bands[1].Groups["Orders"];
    this.ultraGrid.DisplayLayout.Bands[1].Columns["OrderDate"].Level = 1;

    this.ultraGrid.DisplayLayout.Bands[1].Groups["Orders"].Header.Appearance.BackColor = Color.LightSteelBlue;
}

#endregion
728x90
반응형
그리드형(광고전용)
Posted by 사용자 icodebroker

댓글을 달아 주세요