Page 1 of 1

TChart.Cursor: Cursor only updates when moving.

Posted: Mon Nov 24, 2014 3:41 pm
by 15670310
My application dynamically has to change the Cursor of TChart. E.g. on a mouse down I want to change the cursor. But when I set a new cursor it is not immediately displayed in the TChart - the new changed cursor only show after I have moved the mouse. This is not what I would expect because other control show the changed mouse cursor immediately.

E.g.:
- Form with a Button and a TChart on it.
- A timer which calls this code:

Code: Select all

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (tChart1.Cursor == Cursors.Arrow)
            {
                tChart1.Cursor = Cursors.Cross;
                btnAdd.Cursor = Cursors.Cross;
            }
            else
            {
                tChart1.Cursor = Cursors.Arrow;
                btnAdd.Cursor = Cursors.Arrow;
            }
        }
- When the Cursor rests on the button it will change between Cross and Arrow periodically as exptected.
- When the Cursor rests on the TChart it will not change. Why?

Re: TChart.Cursor: Cursor only updates when moving.

Posted: Tue Nov 25, 2014 11:12 am
by Christopher
arnadan wrote: - When the Cursor rests on the TChart it will not change. Why?
This is a defect which I have entered into the database with id=1020.

In the meantime, you can use a workaround similar to the following:

Code: Select all

    private void timer1_Tick(object sender, EventArgs e)
    {
      if (tChart1.Cursor == Cursors.Arrow)
      {
        tChart1.Cursor = Cursors.Cross;
        button1.Cursor = Cursors.Cross;
        if (tChart1.Parent.Bounds.Contains(Cursor.Position)) Cursor.Current = Cursors.Cross; //or equivalent
      }
      else
      {
        tChart1.Cursor = Cursors.Arrow;
        button1.Cursor = Cursors.Arrow;
        if (tChart1.Parent.Bounds.Contains(Cursor.Position)) Cursor.Current = Cursors.Arrow; //or equivalent
      }
    }