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

TestProject.zip
다운로드

▶ MainForm.cs

using System.Drawing;

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

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

        #region 생성자 - MainForm()

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

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

            GaugeControl gaugeControl = new GaugeControl();

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

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

            LinearGauge linearGauge = new LinearGauge();

            linearGauge.Name   = "linearGauge";
            linearGauge.Bounds = new Rectangle(5, 5, 255, 255);

            gaugeControl.Gauges.Add(linearGauge);

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

            LinearScaleComponent linearScaleComponent = new LinearScaleComponent();

            linearScaleComponent.Name                             = "linearScaleComponent";
            linearScaleComponent.AppearanceTickmarkText.Font      = new Font("Tahoma", 10f);
            linearScaleComponent.AppearanceTickmarkText.TextBrush = new SolidBrushObject("Color:White");
            linearScaleComponent.MajorTickCount                   = 7;
            linearScaleComponent.MajorTickmark.FormatString       = "{0:F0}";
            linearScaleComponent.MajorTickmark.ShapeOffset        = 6f;
            linearScaleComponent.MajorTickmark.ShapeType          = TickmarkShapeType.Linear_Style7_3;
            linearScaleComponent.MajorTickmark.TextOffset         = 35f;
            linearScaleComponent.MinorTickCount                   = 4;
            linearScaleComponent.MinorTickmark.ShapeOffset        = 6f;
            linearScaleComponent.MinorTickmark.ShapeType          = TickmarkShapeType.Linear_Style7_2;
            linearScaleComponent.EndPoint                         = new PointF2D(62.5f, 33f );
            linearScaleComponent.StartPoint                       = new PointF2D(62.5f, 217f);
            linearScaleComponent.MaxValue                         = 60f;
            linearScaleComponent.MinValue                         = -60f;
            linearScaleComponent.Value                            = 10f;

            linearGauge.Scales.Add(linearScaleComponent);

            #endregion
            #region 선형 스케일 레벨 컴포넌트를 설정한다.

            LinearScaleLevelComponent linearScaleLevelComponent = new LinearScaleLevelComponent();

            linearScaleLevelComponent.Name        = "linearScaleLevelComponent";
            linearScaleLevelComponent.LinearScale = linearScaleComponent;
            linearScaleLevelComponent.ShapeType   = LevelShapeSetType.Style7;
            linearScaleLevelComponent.ZOrder      = -50;

            linearGauge.Levels.Add(linearScaleLevelComponent);

            #endregion
            #region 선형 스케일 범위 1을 설정한다.

            LinearScaleRange linearScaleRange1 = new LinearScaleRange();

            linearScaleRange1.Name                         = "linearScaleRange1";
            linearScaleRange1.AppearanceRange.ContentBrush = new SolidBrushObject("Color:DeepSkyBlue");
            linearScaleRange1.ShapeOffset                  = -20f;
            linearScaleRange1.StartValue                   = -60f;
            linearScaleRange1.EndValue                     = 0f;

            linearScaleComponent.Ranges.Add(linearScaleRange1);

            #endregion
            #region 선형 스케일 범위 2를 설정한다.

            LinearScaleRange linearScaleRange2 = new LinearScaleRange();

            linearScaleRange2.Name                         = "Range1";
            linearScaleRange2.AppearanceRange.ContentBrush = new SolidBrushObject("Color:DarkOrange");
            linearScaleRange2.ShapeOffset                  = -20F;
            linearScaleRange2.StartValue                   = 0f;
            linearScaleRange2.EndValue                     = 60f;

            linearScaleComponent.Ranges.Add(linearScaleRange2);

            #endregion
            #region 선형 스케일 배경 레이어 컴포넌트를 설정한다.

            LinearScaleBackgroundLayerComponent linearScaleBackgroundLayerComponent = new LinearScaleBackgroundLayerComponent();

            linearScaleBackgroundLayerComponent.Name          = "linearScaleBackgroundLayerComponent";
            linearScaleBackgroundLayerComponent.LinearScale   = linearScaleComponent;
            linearScaleBackgroundLayerComponent.ScaleEndPos   = new PointF2D(0.497f, 0.135f);
            linearScaleBackgroundLayerComponent.ScaleStartPos = new PointF2D(0.497f, 0.865f);
            linearScaleBackgroundLayerComponent.ShapeType     = BackgroundLayerShapeType.Linear_Style7;
            linearScaleBackgroundLayerComponent.ZOrder        = 1000;

            linearGauge.BackgroundLayers.Add(linearScaleBackgroundLayerComponent);

            #endregion
        }

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

댓글을 달아 주세요