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

TestProject.zip
다운로드

▶ MainForm.cs

using System.ComponentModel;
using System.Drawing;

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

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

        #region 생성자 - MainForm()

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

            ComponentResourceManager resourceManager = new ComponentResourceManager(typeof(MainForm));

            #region 이미지 지시자 컴포넌트를 설정한다.

            ImageIndicatorComponent imageIndicatorComponent = new ImageIndicatorComponent();

            imageIndicatorComponent.Name     = "imageIndicatorComponent";
            imageIndicatorComponent.Position = new PointF2D(125f, 125f);
            imageIndicatorComponent.ZOrder   = -1000;
            imageIndicatorComponent.Image    = Properties.Resources.flame;

            #endregion
            #region 레이블 컴포넌트를 설정한다.

            LabelComponent labelComponent = new LabelComponent();

            labelComponent.Name                = "labelComponent";
            labelComponent.Position            = new PointF2D(200f, 100f);
            labelComponent.Size                = new SizeF(50F, 40F);
            labelComponent.AppearanceText.Font = new Font("Tahoma", 24F, FontStyle.Regular, GraphicsUnit.Pixel);
            labelComponent.Text                = "95";
            labelComponent.ZOrder              = -1000;

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

            ArcScaleComponent arcScaleComponent1 = new ArcScaleComponent();

            arcScaleComponent1.Name                                 = "arcScaleComponent1";
            arcScaleComponent1.Center                               = new PointF2D(125f, 125f);
            arcScaleComponent1.RadiusX                              = 100f;
            arcScaleComponent1.RadiusY                              = 100f;
            arcScaleComponent1.StartAngle                           = 90f;
            arcScaleComponent1.EndAngle                             = 450f;
            arcScaleComponent1.AppearanceMinorTickmark.BorderBrush  = new SolidBrushObject("Color:White");
            arcScaleComponent1.AppearanceMinorTickmark.ContentBrush = new SolidBrushObject("Color:White");
            arcScaleComponent1.AppearanceMajorTickmark.BorderBrush  = new SolidBrushObject("Color:White");
            arcScaleComponent1.AppearanceMajorTickmark.ContentBrush = new SolidBrushObject("Color:White");
            arcScaleComponent1.AppearanceTickmarkText.TextBrush     = new SolidBrushObject("Color:#484E5A");
            arcScaleComponent1.AppearanceTickmarkText.Font          = new Font("Tahoma", 8.5f);
            arcScaleComponent1.MinorTickCount                       = 0;
            arcScaleComponent1.MinorTickmark.ShapeOffset            = -7f;
            arcScaleComponent1.MinorTickmark.ShapeType              = TickmarkShapeType.Circular_Style16_2;
            arcScaleComponent1.MajorTickCount                       = 0;
            arcScaleComponent1.MajorTickmark.FormatString           = "{0:F0}";
            arcScaleComponent1.MajorTickmark.ShapeOffset            = -14f;
            arcScaleComponent1.MajorTickmark.ShapeType              = TickmarkShapeType.Circular_Style16_1;
            arcScaleComponent1.MajorTickmark.TextOrientation        = LabelOrientation.LeftToRight;
            arcScaleComponent1.MinValue                             = 0f;
            arcScaleComponent1.MaxValue                             = 100f;
            arcScaleComponent1.Value                                = 50f;

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

            ArcScaleComponent arcScaleComponent2 = new ArcScaleComponent();

            arcScaleComponent2.Name                                 = "arcScaleComponent2";
            arcScaleComponent2.Center                               = new PointF2D(125f, 125f);
            arcScaleComponent2.RadiusX                              = 80f;
            arcScaleComponent2.RadiusY                              = 80f;
            arcScaleComponent2.StartAngle                           = 90f;
            arcScaleComponent2.EndAngle                             = 315f;
            arcScaleComponent2.AppearanceMinorTickmark.BorderBrush  = new SolidBrushObject("Color:White");
            arcScaleComponent2.AppearanceMinorTickmark.ContentBrush = new SolidBrushObject("Color:White");
            arcScaleComponent2.AppearanceMajorTickmark.BorderBrush  = new SolidBrushObject("Color:White");
            arcScaleComponent2.AppearanceMajorTickmark.ContentBrush = new SolidBrushObject("Color:White");
            arcScaleComponent2.AppearanceTickmarkText.TextBrush     = new SolidBrushObject("Color:#484E5A");
            arcScaleComponent2.AppearanceTickmarkText.Font          = new Font("Tahoma", 8.5f);
            arcScaleComponent2.MinorTickCount                       = 0;
            arcScaleComponent2.MinorTickmark.ShapeOffset            = -7F;
            arcScaleComponent2.MinorTickmark.ShapeType              = TickmarkShapeType.Circular_Style16_2;
            arcScaleComponent2.MajorTickCount                       = 0;
            arcScaleComponent2.MajorTickmark.FormatString           = "{0:F0}";
            arcScaleComponent2.MajorTickmark.ShapeOffset            = -14F;
            arcScaleComponent2.MajorTickmark.ShapeType              = TickmarkShapeType.Circular_Style16_1;
            arcScaleComponent2.MajorTickmark.TextOrientation        = LabelOrientation.LeftToRight;
            arcScaleComponent2.MinValue                             = 0f;
            arcScaleComponent2.MaxValue                             = 100f;
            arcScaleComponent2.Value                                = 50f;

            #endregion
            #region 아크 스타일 범위 막대 컴포넌트 1을 설정한다.

            ArcScaleRangeBarComponent arcScaleRangeBarComponent1 = new ArcScaleRangeBarComponent();

            arcScaleRangeBarComponent1.Name           = "arcScaleRangeBarComponent1";
            arcScaleRangeBarComponent1.ZOrder         = -10;
            arcScaleRangeBarComponent1.StartOffset    = 80f;
            arcScaleRangeBarComponent1.EndOffset      = 5f;
            arcScaleRangeBarComponent1.ArcScale       = arcScaleComponent1;
            arcScaleRangeBarComponent1.ShowBackground = true;
            arcScaleRangeBarComponent1.RoundedCaps    = false;

            #endregion
            #region 아크 스타일 범위 막대 컴포넌트 2를 설정한다.

            ArcScaleRangeBarComponent arcScaleRangeBarComponent2 = new ArcScaleRangeBarComponent();

            arcScaleRangeBarComponent2.Name           = "arcScaleRangeBarComponent2";
            arcScaleRangeBarComponent2.ZOrder         = -10;
            arcScaleRangeBarComponent2.StartOffset    = 60f;
            arcScaleRangeBarComponent2.EndOffset      = 5f;
            arcScaleRangeBarComponent2.ArcScale       = arcScaleComponent2;
            arcScaleRangeBarComponent2.ShowBackground = true;
            arcScaleRangeBarComponent2.RoundedCaps    = false;

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

            CircularGauge circularGauge = new CircularGauge();

            circularGauge.Name   = "circularGauge";
            circularGauge.Bounds = new Rectangle(5, 5, 250, 250);
            circularGauge.Images.AddRange(new ImageIndicatorComponent[] { imageIndicatorComponent });
            circularGauge.Labels.AddRange(new LabelComponent[] { labelComponent });
            circularGauge.RangeBars.AddRange(new ArcScaleRangeBarComponent[] { arcScaleRangeBarComponent1, arcScaleRangeBarComponent2 });
            circularGauge.Scales.AddRange(new ArcScaleComponent[] { arcScaleComponent1, arcScaleComponent2 });

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

            GaugeControl gaugeControl = new GaugeControl();

            gaugeControl.Name                       = "gaugeControl";
            gaugeControl.Location                   = new Point(100, 100);
            gaugeControl.Size                       = new Size(260, 260);
            gaugeControl.ColorScheme.Color          = Color.FromArgb(255, 128, 0);
            gaugeControl.ColorScheme.TargetElements = TargetElement.RangeBar | TargetElement.ImageIndicator | TargetElement.Label;

            gaugeControl.Gauges.AddRange(new IGauge[] { circularGauge });

            #endregion

            this.Controls.Add(gaugeControl);
        }

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

댓글을 달아 주세요