我可以在CircularGauge中显示一个PerformanceCounter值吗,
代码:
float val = performanceCounter1.NextValue();
((DevExpress.XtraGauges.Win.Gauges.Circular.CircularGauge)gaugeControl1.Gauges[0]).Scales[0].Value = val;
答案 0 :(得分:0)
在我的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;
}
看看这是否有帮助。