첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainForm.cs

using System.Collections.Generic;
using System.Drawing;

using DevExpress.Diagram.Core;
using DevExpress.Utils;
using DevExpress.XtraDiagram;
using DevExpress.XtraEditors;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : XtraForm
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            this.diagramControl.OptionsView.ShowGrid       = false;
            this.diagramControl.OptionsView.ShowRulers     = false;
            this.diagramControl.OptionsView.ShowPageBreaks = false;

            List<ContainerShapeDescription> list = new List<ContainerShapeDescription>();

            list.Add(StandardContainers.Alternating);
            list.Add(StandardContainers.Banner     );
            list.Add(StandardContainers.Classic    );
            list.Add(StandardContainers.Corners    );
            list.Add(StandardContainers.Plain      );

            for(int i = 0; i < list.Count; i++)
            {
                int x = GetColumnIndex(3, i);
                int y = GetRowIndex(3, i);

                DiagramContainer container = new DiagramContainer();

                container.Position        = new PointFloat(x * 200f + 100f, y * 150f + 100f);
                container.Size            = new SizeF(100f, 100f);
                container.Shape           = list[i];
                container.Appearance.Font = new Font("나눔고딕코딩", 10f);
                container.ShowHeader      = true;
                container.Header          = "헤더";

                this.diagramControl.Items.Add(container);
            }

            this.diagramControl.FitToDrawing();
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 행 인덱스 구하기 - GetRowIndex(columnCount, sequenceIndex)

        /// <summary>
        /// 행 인덱스 구하기
        /// </summary>
        /// <param name="columnCount">컬럼 수</param>
        /// <param name="sequenceIndex">순번 인덱스</param>
        /// <returns>행 인덱스</returns>
        private int GetRowIndex(int columnCount, int sequenceIndex)
        {
            return sequenceIndex / columnCount;
        }

        #endregion
        #region 컬럼 인덱스 구하기 - GetColumnIndex(columnCount, sequenceIndex)

        /// <summary>
        /// 컬럼 인덱스 구하기
        /// </summary>
        /// <param name="columnCount">컬럼 수</param>
        /// <param name="sequenceIndex">순번 인덱스</param>
        /// <returns>컬럼 인덱스</returns>
        private int GetColumnIndex(int columnCount, int sequenceIndex)
        {
            return sequenceIndex % columnCount;
        }

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

댓글을 달아 주세요