标签:style blog http color os ar 使用 for sp
关键代码:
/// <summary> /// 自定义ChartControl的Tooltip /// </summary> /// <param name="chart">ChartControl</param> /// <param name="e">MouseEventArgs</param> /// <param name="tooltip">ToolTipController</param> /// <param name="tooltipTitle">ToolTipController的Title</param> /// <param name="paramter">委托</param> public static void CustomToolTip(this ChartControl chart, MouseEventArgs e, ToolTipController tooltip, string tooltipTitle, System.Func<string, double[], string> paramter) { ChartHitInfo _hitInfo = chart.CalcHitInfo(e.X, e.Y); SeriesPoint _point = _hitInfo.SeriesPoint; if (_point != null) { string _msg = paramter(_point.Argument, _point.Values); tooltip.ShowHint(_msg, tooltipTitle); } else { tooltip.HideHint(); } }
使用代码:
private void chartControl1_MouseMove(object sender, MouseEventArgs e) { ChartControl _curChart = sender as ChartControl; _curChart.CustomToolTip(e, toolTipController1, "交易详情", (agr, values) => { return string.Format("时间:{0}\r\n金额:{1}", agr, values[0]); }); }
运行效果:
[DevExpress]ChartControl之自定义Tooltip示例
标签:style blog http color os ar 使用 for sp
原文地址:http://www.cnblogs.com/Yan-Zhiwei/p/4042741.html