duheng
8 天以前 4de480ec624d3b79ca690dc906e10cd2fbdc9be7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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;
        }
    }
}