[英]C# Winform finding coordinates of a chart
I'm new to C#. 我是C#的新手。 I'm trying to build an application, which represents line charts for different data series.
我正在尝试构建一个应用程序,它代表不同数据系列的折线图。 When I run the application, it paints all the charts, So there is a scroll bar, because not all the charts may be contained on a screen.
当我运行应用程序时,它会绘制所有图表,因此有一个滚动条,因为并非所有图表都可以包含在屏幕上。 In addition I have a tree-view with the names of each series.
另外,我有一个树视图,其中包含每个系列的名称。 I want to give this functionality to the tree-view: When I click on a node within a tree, the corresponding chart to this node should appear on the screen.
我想将此功能提供给树视图:当我单击树中的节点时,该节点的相应图表应出现在屏幕上。 That means, the scroll bar should be scrolled to a specific position, where the desired chart is located.
这意味着,滚动条应滚动到特定位置,所需的图表位于该位置。 Any ideas how can I do it?
任何想法我该怎么办? How to get the coordinates of the chart relative to the Form.
如何获取图表相对于表格的坐标。
I paint the charts at tableLayoutPanel. 我在tableLayoutPanel上绘制图表。
for (int i = 0; i < 3; i++)
{
switch (i)
{
case 0:
for (int j = 0; j < Red_charts.Count; j++)
{
tableLayoutPanel1.Controls.Add(Red_charts.ElementAt(j));
}
break;
case 1:
for (int j = 0; j < Yellow_charts.Count; j++)
{
tableLayoutPanel1.Controls.Add(Yellow_charts.ElementAt(j));
}
break;
default:
for (int j = 0; j < Green_charts.Count; j++)
{
tableLayoutPanel1.Controls.Add(Green_charts.ElementAt(j));
}
break;
}//switch
}//for 3 colors
This is how the charts are added. 这就是图表的添加方式。
I was looking for the tableLayoutPanel.ScrollControlIntoView property. 我一直在寻找tableLayoutPanel.ScrollControlIntoView属性。 Problem solved.
问题解决了。 Thanks.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.