Page 1 of 1

Panning Cursor style

Posted: Mon Jul 10, 2006 5:10 am
by 9790735
Is it possible to change the mouse cursro to 'Hand' while panning with the rmouse key? I tired with mouseup/mousedown etc. but it gets overriden.

thanks,

Posted: Mon Jul 10, 2006 8:12 am
by narcis
Hi matthbri,

Yes, you can use something like this:

Code: Select all

    private Boolean IsScrolling = false;

    private void tChart1_MouseDown(object sender, MouseEventArgs e)
    {
      if (e.Button == MouseButtons.Right)
      {
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Hand;
        IsScrolling = true;
      }
      else
      {
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
        IsScrolling = false;
      }        
    }

    private void tChart1_MouseUp(object sender, MouseEventArgs e)
    {
      System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
      IsScrolling = false;
    }

    private void tChart1_MouseMove(object sender, MouseEventArgs e)
    {
      if (IsScrolling)
      {
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Hand;
      }
      else
      {
        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
      }        
    }