Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
Web gauge made easy?
posted

Hi,

Is there any way that I can do the following?

1) Drop a web-gauge on a page

2) Select a style

3) Set it's value at run-time (i.e. where I want the needle to be set at) using 1-2 lines of C# code?

I can do steps 1 and 2, but I've been looking at the help for hours and all the examples either rely on you setting the needle at a static point (using the GUI) or creating the whole thing from scratch using code. I just want to drag and drop, then set the needle value at run-time using C#.

It's very frustrating that it's been made so complicated. Needles, brushes, markers, pens, scales...  I know that this gives a lot of options, but I feel like you are practically asking us to create the whole guage ourselves from scratch. We may as well just learn System.Drawing ...

We bought the controls so that we can do cool things quickly.  All the help files are rediculously long and complicated - surely there should simply be a "Max" "Min" and "Selected Value" property, for the 98% of us who just want to use the most popular 2% of the features?

Thanks

 Alistair

Parents
  • 10880
    posted

    I am assuming by Style you mean a preset.  Here is step 3 for the Basic01 preset:

    ((RadialGauge)this.UltraGauge1.Gauges[0]).Scales[0].Markers[0].Value = 50;

     

    One of the first things you have to do is access the Gauge you want to modify.  I am indexing into the collection at the zero position.  Then you have to cast it to the appropriate type (RadialGauge, LinearGauge, DigitalGauge).  Depending on the hierarchy (you can look at the hierarchy in the designer), you have to get to the marker and set the value.  This is going to be the same thign for the LinearGauge but for the DigitalGauge i believe you want to look for the Text property.

Reply Children