我已经设法使用developxress创建一个循环语言遵循他们的代码示例,但我有一个问题。一旦控件被创建,我不知道如何使用它们的函数来更新控件。
他们确实有一个如何使用更新面板的例子,所以我正在考虑我最好的选择是动态地添加一个更新面板,但我如何将它附加到创建的每个控件上,所以只有一种语言会改变它的值
https://documentation.devexpress.com/AspNet/CustomDocument11286
表单加载代码:
dgh.CreateCircularGauge(25, pnlTorgue);
dgh.CreateCircularGauge(45, pnlRpm);
dgh.CreateCircularGauge(75, pnlSpeedkmh);
dgh.CreateThemomenter(85, pnlEngTemp);
**我想从这个问题得到什么**
Is说"呸"的能力。CreatCircularGuage(oldValue, NewValue, UpdateBoolean,mypanel);这样我就可以使用aspxtimer tick事件调用它了?这可能吗
public void CreateCircularGauge(int guageValue, Panel mypanel)
{
// Creates a new instance of the ASPxGaugeControl class with default settings.
ASPxGaugeControl gaugeControl = new ASPxGaugeControl();
gaugeControl.EnableCallbackAnimation = true;
// Creates a new instance of the CircularGauge class and adds it
// to the gauge control's Gauges collection.
CircularGauge circularGauge = (CircularGauge)gaugeControl.AddGauge(GaugeType.Circular);
// Adds the default elements (a scale, background layer, needle and spindle cap).
circularGauge.AddDefaultElements();
// Changes the background layer's paint style.
ArcScaleBackgroundLayer background = circularGauge.BackgroundLayers[0];
background.ShapeType = BackgroundLayerShapeType.CircularFull_Style2;
// Customizes the scale's settings.
ArcScaleComponent scale = circularGauge.Scales[0];
scale.MinValue = 0;
scale.MaxValue = 100;
scale.Value = guageValue;
scale.MajorTickCount = 6;
scale.MajorTickmark.FormatString = "{0:F0}";
scale.MajorTickmark.ShapeType = TickmarkShapeType.Circular_Style1_2;
scale.MajorTickmark.ShapeOffset = -9;
scale.MajorTickmark.AllowTickOverlap = true;
scale.MinorTickCount = 3;
scale.MinorTickmark.ShapeType = TickmarkShapeType.Circular_Style2_1;
scale.AppearanceTickmarkText.TextBrush = new SolidBrushObject(Color.Gray);
// Changes the needle's paint style.
ArcScaleNeedleComponent needle = circularGauge.Needles[0];
needle.ShapeType = NeedleShapeType.CircularFull_Style3;
// Adds the gauge control to the Page.
gaugeControl.Width = 250;
gaugeControl.Height = 250;
gaugeControl.AutoLayout = true;
mypanel.Controls.Add(gaugeControl);
}
要单独更新每个测量,最好的解决方案是使用aspxgaugeecontrol。PerformCallback方法。您应该在Timer客户端事件中调用此方法,然后处理aspxgauecontrol。服务器端的CustomCallback事件,根据需要更新测量值:
<script type="text/javascript">
var isDirty;
function gaugePerformCallback() {
var gauge = window['gauge'];
isDirty = gauge.InCallback();
if (!isDirty)
gauge.PerformCallback();
}
function gaugeEndCallback() {
if (isDirty)
window.setTimeout(function() { gaugePerformCallback() }, 0);
}
</script>
...
<dx:ASPxGaugeControl runat="server" Width="250px" Height="250px" BackColor="Transparent" ID="gaugeControl" ClientInstanceName="gauge"
SaveStateOnCallbacks="false">
<ClientSideEvents EndCallback="gaugeEndCallback" />
...
</dx:ASPxGaugeControl >
<dx:ASPxTimer ID="timer" runat="server" Interval="500">
<ClientSideEvents Tick="function(s, e) {
gaugePerformCallback();
}"></ClientSideEvents>
</dx:ASPxTimer>
服务器端后台代码:void gaugeControl_CustomCallback(object source, DevExpress.Web.CallbackEventArgsBase e) {
gaugeControl.Value = /* value */;
}