码迷,mamicode.com
首页 > 其他好文 > 详细

DEV Chart控件鼠标选中某条曲线

时间:2020-04-07 16:59:19      阅读:91      评论:0      收藏:0      [点我收藏+]

标签:int   div   nts   public   single   selected   code   null   element   

 1   this.Chart.ObjectSelected += new DevExpress.XtraCharts.HotTrackEventHandler(this.Chart_ObjectSelected);
 2             this.Chart.ObjectHotTracked += new DevExpress.XtraCharts.HotTrackEventHandler(this.Chart_ObjectHotTracked);
 3             Chart.SelectionMode = ElementSelectionMode.Single;
 4             //Chart.SeriesSelectionMode = SeriesSelectionMode.Point;
 5 
 6  public Series seriesSelected = null;
 7         public SeriesPoint pointSelected = null;
 8         public object selectedAnotherObject = null;
 9         bool SeriesSelection = true;
10 
11         protected virtual bool AllowSelectAnotherObject(object obj)
12         {
13             return false;
14         }
15         private void Chart_ObjectSelected(object sender, HotTrackEventArgs e)
16         {
17             if (e.Object is Series)
18             {
19                 e.Cancel = !SeriesSelection;
20                 if (SeriesSelection) 
21                 {
22                     this.seriesSelected = (Series)e.Object;
23                     this.pointSelected = e.AdditionalObject as SeriesPoint;
24                 }
25             }
26             else
27             {
28                 if (AllowSelectAnotherObject(e.Object))
29                 {
30                     this.selectedAnotherObject = e.Object;
31                     e.Cancel = false;
32                 }
33                 else
34                 {
35                     this.selectedAnotherObject = null;
36                     e.Cancel = true;
37                     Chart.ClearSelection(false);
38                 }
39                 if (SeriesSelection)
40                 {
41                     this.seriesSelected = null;
42                     this.pointSelected = null;
43                 }
44             }
45         }
46 
47         private void Chart_ObjectHotTracked(object sender, HotTrackEventArgs e)
48         {
49             if (e.Object is Series)
50                 e.Cancel = !SeriesSelection;
51             else
52                 e.Cancel = !AllowSelectAnotherObject(e.Object);
53         } 

 

DEV Chart控件鼠标选中某条曲线

标签:int   div   nts   public   single   selected   code   null   element   

原文地址:https://www.cnblogs.com/VueDi/p/12654241.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!