回复 3楼mingcedar的帖子
可以通过判断 MouseLeftButtonDown 和 MouseLeftButtonUp 的距离:
- public MainWindow()
- {
- InitializeComponent();
- this.c1Chart1.MouseLeftButtonDown += new MouseButtonEventHandler(c1Chart1_MouseLeftButtonDown);
- this.c1Chart1.MouseLeftButtonUp += new MouseButtonEventHandler(c1Chart1_MouseLeftButtonUp);
- }
- Point mouseDown;
- Point mouseUp;
- void c1Chart1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
- {
- mouseUp = e.GetPosition(this.c1Chart1);
- double xd = System.Math.Abs(mouseDown.X - mouseUp.X);
- double yd = System.Math.Abs(mouseDown.Y - mouseUp.Y);
- if (xd > 5 && yd > 5)
- {
- }
- }
- void c1Chart1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
- {
- mouseDown = e.GetPosition(this.c1Chart1);
- }
复制代码 |