我正在使用TeeChart的WinForm版本:4.1.2016.5122。但是,当鼠标移动到系列并单击它们时,不会触发相关事件。有没有人遇到过这个问题?
for (int i = 0; i < 4; i++)
{
HorizBar bar = new HorizBar(m_barChart.Chart);
bar.MultiBar = MultiBars.Stacked;
bar.Cursor = Cursors.Hand;
bar.BarHeightPercent = 100;
bar.CustomBarWidth = 20;
//Event registered below will not be fired up
bar.Click += Bar_Click1;
bar.Depth = 50;
bar.DepthPercent = 50;
bar.Marks.Visible = false;
bar.Color = Color.Blue;
bar.Add(i, 0);
bar.Title = string.Format(" {0} {1}", i, i);
}
//Event registered below is not fired up
m_barChart.ClickSeries += M_barChart_ClickSeries;
使用以下代码使用 TeeChart.Net v4.1.2016.5122,ClickSeries 可以毫无问题地触发。
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
for (int i = 0; i < 4; i++)
{
HorizBar bar = new HorizBar(tChart1.Chart);
bar.MultiBar = MultiBars.Stacked;
bar.Cursor = Cursors.Hand;
bar.BarHeightPercent = 100;
bar.CustomBarWidth = 20;
bar.Depth = 50;
bar.DepthPercent = 50;
bar.Marks.Visible = false;
bar.Color = Color.Blue;
bar.Add(i, 0);
bar.Title = string.Format(" {0} {1}", i, i);
}
tChart1.ClickSeries += TChart1_ClickSeries;
}
private void TChart1_ClickSeries(object sender, Series s, int valueIndex, MouseEventArgs e)
{
this.Text = s.Title;
}
您能否再次检查代码并确认我们它是否在您最终有效?