DevExpress CircularGauge 取值和性能计数器

DevExpress CircularGauge To Take Value And PerformanceCounter

我可以在 CircularGauge 中显示 PerformanceCounter 的值吗,

代码:

float val = performanceCounter1.NextValue();

       ((DevExpress.XtraGauges.Win.Gauges.Circular.CircularGauge)gaugeControl1.Gauges[0]).Scales[0].Value = val;

在我的 CircularGauge 案例中,我必须同时设置 Value 和 MaxValue:

((DevExpress.XtraGauges.Win.Gauges.Circular.CircularGauge)gaugeControl1.Gauges[0]).Scales[0].Value = val;

((DevExpress.XtraGauges.Win.Gauges.Circular.CircularGauge)gaugeControl1.Gauges[0]).Scales[0].MaxValue = GetGaugeMaxValue(val);

...

// helper function
private float GetGaugeMaxValue(float val)
        {
            float ret = 100;

            if (val < 100)
                ret = 100;
            else if (val < 1000)
                ret = 1000;
            else if (val < 10000)
                ret = 10000;
            else if (val < 100000)
                ret = 100000;
            else if (val < 1000000)
                ret = 1000000;

            return ret;
        }

看看这是否有帮助。