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

TestProject.zip
다운로드

▶ MainForm.cs

using System.Drawing;

using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGauges.Win;
using DevExpress.XtraGauges.Win.Gauges.Circular;
using DevExpress.XtraGauges.Core.Model;
using DevExpress.XtraGauges.Core.Drawing;

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

        #region 생성자 - MainForm()

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

            #region 게이지 컨트롤을 설정한다.

            GaugeControl gaugeControl = new GaugeControl();

            gaugeControl.Parent      = this;
            gaugeControl.Location    = new Point(50, 50);
            gaugeControl.Size        = new Size(400, 400);
            gaugeControl.BackColor   = Color.Transparent;
            gaugeControl.BorderStyle = BorderStyles.NoBorder;

            #endregion
            #region 환형 게이지를 설정한다.

            CircularGauge circularGauge = gaugeControl.AddCircularGauge();

            circularGauge.AddDefaultElements();

            #endregion
            #region 아크 스케일 배경 레이어를 설정한다.

            ArcScaleBackgroundLayer arcScaleBackgroundLayer = circularGauge.BackgroundLayers[0];

            arcScaleBackgroundLayer.ShapeType = BackgroundLayerShapeType.CircularFull_Style3;

            #endregion
            #region 아크 스케일 컴포넌트를 설정한다.

            ArcScaleComponent arcScaleComponent = circularGauge.Scales[0];

            arcScaleComponent.MinValue                         = 0;
            arcScaleComponent.MaxValue                         = 100;
            arcScaleComponent.Value                            = 25;
            arcScaleComponent.AppearanceTickmarkText.Font      = new Font("Tahoma", 10f);
            arcScaleComponent.AppearanceTickmarkText.TextBrush = new SolidBrushObject(Color.White);
            arcScaleComponent.MajorTickCount                   = 11;
            arcScaleComponent.MajorTickmark.FormatString       = "{0:F0}";
            arcScaleComponent.MajorTickmark.ShapeType          = TickmarkShapeType.Circular_Style2_2;
            arcScaleComponent.MajorTickmark.ShapeOffset        = -10;
            arcScaleComponent.MajorTickmark.TextOffset         = -20;
            arcScaleComponent.MajorTickmark.AllowTickOverlap   = true;
            arcScaleComponent.MinorTickCount                   = 3;
            arcScaleComponent.MinorTickmark.ShapeType          = TickmarkShapeType.Circular_Style2_1;

            #endregion
            #region 아크 스케일 바늘 컴포넌트를 설정한다.

            ArcScaleNeedleComponent arcScaleNeedleComponent = circularGauge.Needles[0];

            arcScaleNeedleComponent.ShapeType = NeedleShapeType.CircularFull_Style3;

            #endregion
            #region 아크 스케일 스핀들 캡 컴포넌트를 설정한다.

            ArcScaleSpindleCapComponent arcScaleSpindleCapComponent = arcScaleSpindleCapComponent = new ArcScaleSpindleCapComponent();

            arcScaleSpindleCapComponent.Name     = "arcScaleSpindleCapComponent";
            arcScaleSpindleCapComponent.ArcScale = arcScaleComponent;
            arcScaleSpindleCapComponent.Size     = new SizeF(42F, 42F);
            arcScaleSpindleCapComponent.ZOrder   = -1000;
            arcScaleSpindleCapComponent.Shader   = new OpacityShader();

            circularGauge.SpindleCaps.Add(arcScaleSpindleCapComponent);

            #endregion
        }

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

댓글을 달아 주세요