■ 커스텀 3D 선 그리기

----------------------------------------------------------------------------------------------------


TestProject.zip


MainForm.cs

 

 

using System;

using System.Windows.Forms;

 

using Steema.TeeChart.Drawing;

using Steema.TeeChart.Styles;

 

namespace TestProject

{

    /// <summary>

    /// 메인 폼

    /// </summary>

    public partial class MainForm : Form

    {

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor

        ////////////////////////////////////////////////////////////////////////////////////////// Public

 

        #region 생성자 - MainForm()

 

        /// <summary>

        /// 생성자

        /// </summary>

        public MainForm()

        {

            InitializeComponent();

 

            Load += Form_Load;

        }

 

        #endregion

 

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method

        ////////////////////////////////////////////////////////////////////////////////////////// Private

        //////////////////////////////////////////////////////////////////////////////// Event

 

        #region 폼 로드시 처리하기 - Form_Load(sender, e)

 

        /// <summary>

        /// 폼 로드시 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="e">이벤트 인자</param>

        private void Form_Load(object sender, EventArgs e)

        {

            this.tChart.Aspect.Chart3DPercent = 50;

 

            this.tChart.AfterDraw += tChart_AfterDraw;

 

            Line line = new Line(this.tChart.Chart);

 

            line.HorizAxis = HorizontalAxis.Both;

            line.VertAxis  = VerticalAxis.Both;

 

            line.FillSampleValues(20);

        }

        

        #endregion

        #region 티차트 그리기 후 처리하기 - tChart_AfterDraw(sender, graphics3D)

 

        /// <summary>

        /// 티차트 그리기 후 처리하기

        /// </summary>

        /// <param name="sender">이벤트 발생자</param>

        /// <param name="graphics3D">이벤트 인자</param>

        private void tChart_AfterDraw(object sender, Graphics3D graphics3D)

        {

            Point3D startPoint = new Point3D();

            

            startPoint.X = tChart.Axes.Left.Position;

            startPoint.Y = tChart.Axes.Top.Position;

            startPoint.Z = 0;

            

            Point3D endPoint = new Point3D();

            

            endPoint.X = tChart.Axes.Right.Position;

            endPoint.Y = tChart.Axes.Bottom.Position;

            endPoint.Z = tChart.Aspect.Width3D;

            

            graphics3D.MoveTo(startPoint);

            graphics3D.LineTo(endPoint);

        }

 

        #endregion

    }

}

 

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요