첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
using System;

using Infragistics.Win.UltraWinGrid;

#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)
{
    e.Layout.Override.MergedCellStyle = MergedCellStyle.Always;

    e.Layout.Bands[0].Columns["ShippedDate"].MergedCellEvaluator = new CustomMergedCellEvaluator();
}

#endregion

...

/// <summary>
/// 커스텀 병합 셀 평가자
/// </summary>
public class CustomMergedCellEvaluator: IMergedCellEvaluator
{
    //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 생성자 - CustomMergedCellEvaluator()

    /// <summary>
    /// 생성자
    /// </summary>
    public CustomMergedCellEvaluator()
    {
    }

    #endregion

    //////////////////////////////////////////////////////////////////////////////////////////////////// Method
    ////////////////////////////////////////////////////////////////////////////////////////// Public

    #region 셀 병합 여부 구하기 - ShouldCellsBeMerged(ultraGridRow1, ultraGridRow2, ultraGridColumn)

    /// <summary>
    /// 셀 병합 여부 구하기
    /// </summary>
    /// <param name="ultraGridRow1">UltraGridRow 1</param>
    /// <param name="ultraGridRow2">UltraGridRow 2</param>
    /// <param name="ultraGridColumn">UltraGridColumn</param>
    /// <returns>셀 병합 여부</returns>
    public bool ShouldCellsBeMerged(UltraGridRow ultraGridRow1, UltraGridRow ultraGridRow2, UltraGridColumn ultraGridColumn)
    {
        object cellValue1 = ultraGridRow1.GetCellValue(ultraGridColumn);
        object cellValue2 = ultraGridRow2.GetCellValue(ultraGridColumn);

        if(cellValue1 != DBNull.Value && cellValue2 != DBNull.Value)
        {
            DateTime dateTime1 = (DateTime)ultraGridRow1.GetCellValue(ultraGridColumn);
            DateTime dateTime2 = (DateTime)ultraGridRow2.GetCellValue(ultraGridColumn);

            return dateTime1.Date == dateTime2.Date;
        }
        else
        {
            return false;
        }
    }

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

댓글을 달아 주세요