728x90
반응형
728x170
▶ MainForm.cs
using System;
using System.Drawing;
using DevExpress.XtraEditors;
using DevExpress.XtraGauges.Core.Model;
namespace TestProject
{
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : XtraForm
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
this.temperatureArcScaleComponent.EnableAnimation = true;
this.temperatureArcScaleComponent.EasingMode = EasingMode.EaseIn;
this.temperatureArcScaleComponent.EasingFunction = new CircleEase();
this.humidityArcScaleComponent.EnableAnimation = true;
this.humidityArcScaleComponent.EasingMode = EasingMode.EaseOut;
this.humidityArcScaleComponent.EasingFunction = new BackEase();
this.temperatureTrackBarControl.EditValueChanged += temperatureTrackBarControl_EditValueChanged;
this.humidityTrackBarControl.EditValueChanged += humidityTrackBarControl_EditValueChanged;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
//////////////////////////////////////////////////////////////////////////////// Event
#region 온도 트랙바 컨트롤 편집 값 변경시 처리하기 - temperatureTrackBarControl_EditValueChanged(sender, e)
/// <summary>
/// 온도 트랙바 컨트롤 편집 값 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void temperatureTrackBarControl_EditValueChanged(object sender, EventArgs e)
{
this.temperatureArcScaleComponent.Value = Convert.ToSingle(this.temperatureTrackBarControl.EditValue);
this.weatherStateImageIndicatorComponent.StateIndex = GetWeatherType();
string sign = string.Empty;
if(this.temperatureArcScaleComponent.Value > 0)
{
sign = "+";
this.gaugeControl.ColorScheme.Color = Color.Crimson;
}
else
{
this.gaugeControl.ColorScheme.Color = Color.RoyalBlue;
}
this.temperatureLabelComponent.Text = $"t : {sign}{this.temperatureArcScaleComponent.Value}C";
}
#endregion
#region 습도 트랙바 컨트롤 편집 값 변경시 처리하기 - humidityTrackBarControl_EditValueChanged(sender, e)
/// <summary>
/// 습도 트랙바 컨트롤 편집 값 변경시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void humidityTrackBarControl_EditValueChanged(object sender, EventArgs e)
{
this.humidityArcScaleComponent.Value = Convert.ToSingle(this.humidityTrackBarControl.EditValue);
this.weatherStateImageIndicatorComponent.StateIndex = GetWeatherType();
this.humidityLabelComponent.Text = $"h : {humidityArcScaleComponent.Value}%";
}
#endregion
//////////////////////////////////////////////////////////////////////////////// Function
#region 날씨 타입 구하기 - GetWeatherType()
/// <summary>
/// 날씨 타입 구하기
/// </summary>
/// <returns>날씨 타입</returns>
private int GetWeatherType()
{
if(temperatureArcScaleComponent.Value > 0)
{
if(humidityArcScaleComponent.Value < 75)
{
return 0; // SUNNY
}
else
{
return 2; // RAINY
}
}
else
{
if(this.humidityArcScaleComponent.Value < 75)
{
return 1; // CLOWDY
}
else
{
return 3; // SNOW
}
}
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'DevExpress > WinForm' 카테고리의 다른 글
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 디지털 게이지 생성하기 (0) | 2020.06.14 |
---|---|
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 환형 게이지 동적 생성하기 (0) | 2020.06.13 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 게이지 스타일 적용하기 (0) | 2020.06.13 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 게이지 요소 모양 만들기 (0) | 2020.06.13 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 상태 지시자 사용하기 (0) | 2020.06.13 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 환형 게이지 사용하기 (0) | 2020.06.12 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 환형 게이지 동적 생성하기 (0) | 2020.06.12 |
[DEVEXPRESS/WINFORM] GaugeControl 클래스 : 환형 게이지 동적 생성하기 (0) | 2020.06.08 |
[DEVEXPRESS/WINFORM] ArcScaleRangeBarComponent 클래스 : RoundedCaps 속성을 사용해 범위 막대(Range Bar) 에지 스타일 설정하기 (0) | 2020.06.08 |
[DEVEXPRESS/WINFORM] ArcScaleComponent 클래스 : StartAngle/EndAngle/Value 속성을 사용해 범위 막대(Range Bar)와 현재 값 표시하기 (0) | 2020.06.08 |
댓글을 달아 주세요