How to change C1GaugeCaption value programmatically (C#)?

Originally Posted 17 May 2017, 1:15 pm EST

  • Originally Posted 17 May 2017, 1:15 pm EST

    Hello

    I'm kind of new to C1 objects and trying to update a gauge caption. Below is what I have when I hover my mouse over the caption object in my gauge.

    C1GaugeCaption[c1RadiaGauge21.FaceShape(2)]

    Can someone clip in some super simple code in C# to update this caption when Form1_load, please

    Thanks a million

    Eva
  • Reply

    Right so I've managed to create a new caption by utilizing the following code, however I'd still appreciate to know how to make this work for my existing captions/FaceShapes.


    C1GaugeCaption MyCap = new C1GaugeCaption();
    MyCap.CenterPointX = 0.5;
    MyCap.CenterPointY = 0.5;
    c1RadialGauge21.FaceShapes.Add(MyCap);
    MyCap.Text = "My Text";


    Anyone knows how to "update" the value of an exiting caption, without having to re-create one, please let me know. Sincere apologies for the beginner's question btw *_x

    I need to update this: C1GaugeCaption[c1RadiaGauge21.FaceShape(2)]

    Thanks

    Eva
  • Reply

    Hi Eva,

    Something like this:

    private void Form1_Load(object sender, EventArgs e)
    {
    var MyCap = (C1.Win.C1Gauge.C1GaugeCaption)c1RadialGauge21.FaceShapes[2];
    MyCap.Text = "New Caption";
    }

    Hope that helps.

    Regards,
    -Andrey
  • Marked as Answer

    Reply

    OMG! It works!!!

    Thank you so much for your kind help Andrey, much (much) appreciated. Promise to learn C# over the weekend (hmm)

    Have a great day and thanks again

    Eva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels