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

TestProject.zip
다운로드

▶ MainForm.cs

using System;
using System.Drawing;

using DevExpress.XtraEditors;
using DevExpress.XtraGauges.Core.Base;
using DevExpress.XtraGauges.Core.Model;
using DevExpress.XtraGauges.Win.Gauges.Circular;

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

        #region Field

        /// <summary>
        /// 아크 스케일 상태 지시자 컴포넌트 1
        /// </summary>
        private ArcScaleStateIndicatorComponent arcScaleStateIndicatorComponent1;

        /// <summary>
        /// 아크 스케일 상태 지시자 컴포넌트 2
        /// </summary>
        private ArcScaleStateIndicatorComponent arcScaleStateIndicatorComponent2;

        #endregion

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

        #region 생성자 - MainForm()

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

            #region 아크 스케일 상태 지시자 컴포넌트 1을 설정한다.

            this.arcScaleStateIndicatorComponent1 = new ArcScaleStateIndicatorComponent();

            this.arcScaleStateIndicatorComponent1.Name           = "arcScaleStateIndicatorComponent1";
            this.arcScaleStateIndicatorComponent1.IndicatorScale = this.arcScaleComponent1;
            this.arcScaleStateIndicatorComponent1.Center         = new PointF2D(125f, 225f);
            this.arcScaleStateIndicatorComponent1.Size           = new SizeF(25f, 25f);
            this.arcScaleStateIndicatorComponent1.ZOrder         = -100;

            this.circularGauge.Indicators.Add(this.arcScaleStateIndicatorComponent1);

            #endregion
            #region 스케일 지시자 상태 1을 설정한다.

            ScaleIndicatorState scaleIndicatorState1 = new ScaleIndicatorState();

            scaleIndicatorState1.Name           = "scaleIndicatorState1";
            scaleIndicatorState1.ShapeType      = StateIndicatorShapeType.ElectricLight4;
            scaleIndicatorState1.StartValue     = 0f;
            scaleIndicatorState1.IntervalLength = 50f;

            this.arcScaleStateIndicatorComponent1.States.Add(scaleIndicatorState1);

            #endregion
            #region 스케일 지시자 상태 2를 설정한다.

            ScaleIndicatorState scaleIndicatorState2 = new ScaleIndicatorState();

            scaleIndicatorState2.Name           = "scaleIndicatorState2";
            scaleIndicatorState2.ShapeType      = StateIndicatorShapeType.ElectricLight3;
            scaleIndicatorState2.StartValue     = 50f;
            scaleIndicatorState2.IntervalLength = 30f;

            this.arcScaleStateIndicatorComponent1.States.Add(scaleIndicatorState2);

            #endregion
            #region 스케일 지시자 상태 3을 설정한다.

            ScaleIndicatorState scaleIndicatorState3 = new ScaleIndicatorState();

            scaleIndicatorState3.Name           = "scaleIndicatorState3";
            scaleIndicatorState3.ShapeType      = StateIndicatorShapeType.ElectricLight2;
            scaleIndicatorState3.StartValue     = 80f;
            scaleIndicatorState3.IntervalLength = 20f;

            this.arcScaleStateIndicatorComponent1.States.Add(scaleIndicatorState3);

            #endregion
            #region 아크 스케일 상태 지시자 컴포넌트 2를 설정한다.

            this.arcScaleStateIndicatorComponent2 = new ArcScaleStateIndicatorComponent();

            this.arcScaleStateIndicatorComponent2.Name           = "arcScaleStateIndicatorComponent2";
            this.arcScaleStateIndicatorComponent2.IndicatorScale = this.arcScaleComponent2;
            this.arcScaleStateIndicatorComponent2.Center         = new PointF2D(125f, 190f);
            this.arcScaleStateIndicatorComponent2.Size           = new SizeF(25f, 25f);
            this.arcScaleStateIndicatorComponent2.ZOrder         = -100;

            this.circularGauge.Indicators.Add(this.arcScaleStateIndicatorComponent2);

            #endregion
            #region 스케일 지시자 상태 4를 설정한다.

            ScaleIndicatorState scaleIndicatorState4 = new ScaleIndicatorState();

            scaleIndicatorState4.Name           = "scaleIndicatorState4";
            scaleIndicatorState4.ShapeType      = StateIndicatorShapeType.ElectricLight4;
            scaleIndicatorState4.StartValue     = 0f;
            scaleIndicatorState4.IntervalLength = 700F;

            this.arcScaleStateIndicatorComponent2.States.Add(scaleIndicatorState4);

            #endregion
            #region 스케일 지시자 상태 5를 설정한다.

            ScaleIndicatorState scaleIndicatorState5 = new ScaleIndicatorState();

            scaleIndicatorState5.Name           = "scaleIndicatorState5";
            scaleIndicatorState5.ShapeType      = StateIndicatorShapeType.ElectricLight3;
            scaleIndicatorState5.StartValue     = 700f;
            scaleIndicatorState5.IntervalLength = 200f;

            this.arcScaleStateIndicatorComponent2.States.Add(scaleIndicatorState5);

            #endregion
            #region 스케일 지시자 상태 6을 설정한다.

            ScaleIndicatorState scaleIndicatorState6 = new ScaleIndicatorState();

            scaleIndicatorState6.Name           = "scaleIndicatorState6";
            scaleIndicatorState6.ShapeType      = StateIndicatorShapeType.ElectricLight2;
            scaleIndicatorState6.StartValue     = 900f;
            scaleIndicatorState6.IntervalLength = 100f;

            this.arcScaleStateIndicatorComponent2.States.Add(scaleIndicatorState6);

            #endregion

            this.trackBarControl1.EditValueChanged += trackBarControl1_EditValueChanged;
            this.trackBarControl2.EditValueChanged += trackBarControl2_EditValueChanged;
        }

        #endregion

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

        #region 트랙바 컨트롤 1 편집 값 변경시 처리하기 - trackBarControl1_EditValueChanged(sender, e)

        /// <summary>
        /// 트랙바 컨트롤 1 편집 값 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void trackBarControl1_EditValueChanged(object sender, EventArgs e)
        {
            float value = Convert.ToSingle(this.trackBarControl1.EditValue);

            this.arcScaleComponent1.Value = value;

            this.arcScaleNeedleComponent1.Value = value;
        }

        #endregion
        #region 트랙바 컨트롤 2 편집 값 변경시 처리하기 - trackBarControl2_EditValueChanged(sender, e)

        /// <summary>
        /// 트랙바 컨트롤 2 편집 값 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void trackBarControl2_EditValueChanged(object sender, EventArgs e)
        {
            float value = Convert.ToSingle(this.trackBarControl2.EditValue);

            this.arcScaleComponent2.Value = value;

            this.arcScaleNeedleComponent2.Value = value;
        }

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

댓글을 달아 주세요