using System;
|
using System.Drawing;
|
using System.Windows.Forms;
|
using DevExpress.Skins;
|
using DevExpress.Utils.Drawing;
|
using DevExpress.XtraEditors;
|
using DevExpress.XtraGauges.Base;
|
using DevExpress.XtraGauges.Core.Model;
|
using DevExpress.XtraGauges.Win;
|
using DevExpress.XtraGauges.Win.Base;
|
|
namespace IStation.WinFrmUI.CalcErQu
|
{
|
public partial class GaugeContent : XtraUserControl
|
{
|
//ObjectState stateCore;
|
Color colorCore;
|
public GaugeContent()
|
{
|
InitializeComponent();
|
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
InitGauge();
|
// stateCore = ObjectState.Normal;
|
colorCore = Color.Empty;
|
}
|
protected override void Dispose(bool disposing)
|
{
|
if (disposing && (components != null))
|
{
|
components.Dispose();
|
}
|
|
|
base.Dispose(disposing);
|
}
|
void InitGauge()
|
{
|
arcScaleComponent1.EasingFunction = new CubicEase();
|
arcScaleComponent1.EasingMode = EasingMode.EaseOut;
|
arcScaleComponent1.EnableAnimation = false ;
|
|
}
|
|
|
public GaugeControl Gauge { get { return gaugeControl; } }
|
public string Caption
|
{
|
get { return labelControl1.Text; }
|
set { labelControl1.Text = value; }
|
}
|
|
public Color Color
|
{
|
get { return gaugeControl.ColorScheme.Color; }
|
set
|
{
|
if (!colorCore.IsEmpty && colorCore != gaugeControl.ColorScheme.Color)
|
return;
|
colorCore = value;
|
labelControl1.Appearance.ForeColor = colorCore;
|
gaugeControl.ColorScheme.Color = colorCore;
|
}
|
}
|
public Image Image
|
{
|
get { return imageIndicatorComponent.Image; }
|
set { imageIndicatorComponent.Image = value; }
|
}
|
|
protected override void OnPaint(PaintEventArgs e)
|
{
|
base.OnPaint(e);
|
//DrawBackground(e);
|
}
|
void DrawBackground(PaintEventArgs e)
|
{
|
Rectangle rect = ClientRectangle;
|
rect.Height -= Padding.Vertical;
|
rect.X += Padding.Left;
|
rect.Y += Padding.Top - 10;
|
rect.Width -= Padding.Horizontal;
|
Skin skin = CommonSkins.GetSkin(LookAndFeel);
|
SkinElementInfo elementInfo = new SkinElementInfo(skin[CommonSkins.SkinLayoutItemBackground], rect);
|
//if (Selected)
|
// elementInfo.ImageIndex = 2;
|
////if (Hot)
|
// elementInfo.ImageIndex = 1;
|
using (GraphicsCache cache = new GraphicsCache(e.Graphics, ScaleDPI))
|
ObjectPainter.DrawObject(cache, SkinElementPainter.Default, elementInfo);
|
}
|
|
|
protected override void OnLoad(EventArgs e)
|
{
|
base.OnLoad(e);
|
|
}
|
|
|
|
|
|
|
public void SetValue(double realValue,float percent)
|
{
|
this.labelComponent1.Text = realValue.ToString();
|
this.arcScaleComponent1.Value = percent;
|
}
|
}
|
}
|