How to resolve exception 'cannot convert from 'System.Windows.Forms.MouseEventArgs' to 'Nevron.Chart.Windows.NMouseEventArgs'?


https://www.nevron.com/Forum/Topic9525.aspx
Print Topic | Close Window

By Niranjan Singh - 8 Years Ago
Hi,
I have updated my project with newer version of Nevron Chart dlls. Now there are lots of change from version 12.x.x.x to 16.1.5.12. Most of build issues has been resolved but on of my required functionality work with the standard control events. Below is code snippet which was working correct with standard .net library objects.


NDataPanTool chartDataPanTool;
void chartControl_MouseUp(object sender, MouseEventArgs e)
{
  if (chartControl.Controller.Tools.Contains(chartDataPanTool))
  {
   chartDataPanTool.DoEndDrag(sender, e);
  }
}


Now I am looking for quick fix which resolve such issue with the upgrade. 


Thanks,
Niranjan

By Niranjan Singh - 8 Years Ago
Hi,

I have resolved this compile issue by creating a new NMouseEventArgs object from the MouseEventArgs information.

void chartControl_MouseUp(object sender, MouseEventArgs e)
{
  if (chartControl.Controller.Tools.Contains(chartDataPanTool))
  {
   NMouseEventArgs args = new NMouseEventArgs(chartControl.View,
    (Nevron.Chart.Windows.MouseButton)Enum.Parse(typeof(Nevron.Chart.Windows.MouseButton), e.Button.ToString()),
    e.Clicks, e.X, e.Y, e.Delta);
   chartDataPanTool.DoEndDrag(sender, args);
  }
}

but I am not sure that does it effect the existing functionality or not. I looking forward with Nevron guys for the correctness of these changes.
Thanks,
Niranjan
By Nevron Support - 8 Years Ago
Hi Niranjan,
The workaround is correct - we had to decouple the controller implementation from Winforms classes / enum in order to reuse it in WPF as well...