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

TestProject.zip
0.01MB

▶ MainForm.cs

using System.Drawing;
using System.Windows.Forms;

using Steema.TeeChart.Drawing;
using Steema.TeeChart.Styles;
using Steema.TeeChart.Tools;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : Form
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// 파이
        /// </summary>
        private Pie pie;

        /// <summary>
        /// 파이 도구
        /// </summary>
        private PieTool pieTool;

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

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

            Text = "PieTool 클래스 : 마우스 OVER시 파이 슬라이스 포커스 표시하기";

            this.colorPanel.Visible = false;

            this.tChart.Panel.Pen      = new ChartPen(Color.Black);
            this.tChart.Legend.Visible = false;

            this.pie = new Pie(this.tChart.Chart);

            this.pie.FillSampleValues(6);

            this.pieTool = new PieTool(this.tChart.Chart);

            this.pieTool.Series = this.pie;

            this.tChart.MouseMove += tChart_MouseMove;
        }

        #endregion

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

        #region TChart 마우스 이동시 처리하기 - tChart_MouseMove(sender, e)

        /// <summary>
        /// TChart 마우스 이동시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void tChart_MouseMove(object sender, MouseEventArgs e)
        {
            int sliceIndex = this.pieTool.Slice;

            if(sliceIndex == -1)
            {
                this.sliceValueLabel.Text = string.Empty;

                this.colorPanel.Visible = false;
            }
            else
            {
                this.sliceValueLabel.Text = this.pie.Labels[sliceIndex];

                this.colorPanel.BackColor = this.pie.ValueColor(sliceIndex);
                this.colorPanel.Visible   = true;
            }
        }

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

댓글을 달아 주세요