I am trying to get 2 sets of co ordinates via OnMouseDown using a click counter
#region mouse public void MiddleMouseButtonExample_MouseDown(object sender, MouseButtonEventArgs e) { if(ClickCounter == 0) { if (e.MiddleButton == MouseButtonState.Pressed) { clickPoint.X = ChartingExtensions.ConvertToHorizontalPixels(e.GetPosition(ChartPanel as IInputElement).X, ChartControl.PresentationSource); / clickPoint.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPosition(ChartPanel as IInputElement).Y, ChartControl.PresentationSource); ClickCounter += 1; } }///end ClickCounter = 0 if(ClickCounter == 1) { if (e.LeftButton == MouseButtonState.Pressed) { clickPoint2.X = ChartingExtensions.ConvertToHorizontalPixels(e.GetPosition(ChartPanel as IInputElement).X, ChartControl.PresentationSource); clickPoint2.Y = ChartingExtensions.ConvertToVerticalPixels(e.GetPosition(ChartPanel as IInputElement).Y, ChartControl.PresentationSource); if (clickPoint2.Y > 0) { clickSet = true; barIdx2 = -1; barIdx = -1; } // trigger the chart invalidate so that the render loop starts even if there is no data being received ChartControl.InvalidateVisual(); e.Handled = true; ClickCounter = 0; //Print(clickPoint.X); //Print(clickPoint2.X); } }///end ClickCounter = 1; } #endregion
If I change the mouse button eg leftbutton == MouseButtonState,Pressed first then middle button == MouseButtonState.Pressed - it all works fine - but I just want to click the left button, move the mouse and click the left button again, and then the rest of my logic can be run.
Can anyone point me in the right direction?
Comment