gpt4 book ai didi

c++ - 如何找到 Teechart 图和 Teechart Canvas 的顶部/左侧和顶部/右侧?

转载 作者:行者123 更新时间:2023-11-30 02:38:36 25 4
gpt4 key购买 nike

我正在尝试找出客户端坐标中所有四个角的 Teechart 控件和图形 Canvas 。

有谁知道返回所有四个角的 Canvas 坐标的 Teechart API?

谢谢

最佳答案

要确定图表在窗体中的位置,您可以使用 .Left.Top 图表属性。同理,可以使用ChartRect获取TChart Corners。请看下面的代码:

// CDraggingDlg message handlers

BOOL CDraggingDlg::OnInitDialog()
{
….
CDialog::OnInitDialog();
// Extra initialization
m_ctrlChart.RemoveAllSeries();

m_ctrlChart.GetAspect().SetView3D(false);
m_ctrlChart.AddSeries(scLine);
m_ctrlChart.Series(0).FillSampleValues(100);
return TRUE;
}

std::string text;

void CDraggingDlg::OnAfterDrawTChart()
{

// Draw a white circle around the clicked pyramid...

CTeeRect r = m_ctrlChart.GetGetChartRect();
long recwidth, recheight, posLeft, posTop;

int BottomLCornerX,BottomLCornerY, BottomRCornerX, BottomRCornerY, TopLCornerX, TopLCornerY, TopRCornerX, TopRCornerY;
std::string s1, s2, s3;

//Get Width
recwidth = (r.GetRight()- r.GetLeft());
recheight = (r.GetBottom()-r.GetTop());

//GetPosition
posLeft = m_ctrlChart.GetLeft();
posTop = m_ctrlChart.GetTop();

//CalculateCorners
BottomLCornerX = r.GetLeft();
BottomLCornerY = r.GetBottom();
BottomRCornerX = r.GetRight();
BottomRCornerY = r.GetBottom();
TopLCornerX = r.GetLeft();
TopLCornerY = r.GetTop();
TopRCornerX = r.GetRight;
TopRCornerY = r.GetTop();
//Visualization Values
s1 = "Position Chart :" + std::to_string(posLeft) + "," + std::to_string(posTop);
s2 = "Chart Rect Positons: Left " + std::to_string(r.GetLeft()) + " Top " + std::to_string(r.GetTop()) + " Right " + std::to_string(r.GetRight()) + " Bottom " + std::to_string(r.GetBottom());
s3 = "Chart Rect Corners: BottomLeft " + std::to_string(BottomLCornerX) + "," + std::to_string(BottomLCornerY) + " BottomRight " + std::to_string(BottomRCornerX) + "," +
std::to_string(BottomRCornerY) + "\n TopLeft " + std::to_string(TopLCornerX) + "," + std::to_string(TopLCornerY) + " TopRight " + std::to_string(TopRCornerX) + "," + std::to_string(TopRCornerY);
text = s1 + "\n" + s2 +"\n"+s3 ;
}
void CDraggingDlg::OnButton1()
{MessageBox(text.c_str()); }

关于c++ - 如何找到 Teechart 图和 Teechart Canvas 的顶部/左侧和顶部/右侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30672509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com